amp-script problem
-
i’m having problem with the amp-script implementation.
the code below has 2 checkboxes which are generated within a loop as the groups which each checkbox belong to (the ids) are taken from the loop.<input type="checkbox" name="group1[]" on="tap:AMP.setState({ crox: ((crox != '123') ? '123' : '123')}),croxform.submit" />
<input type="checkbox" name="group2[]" "tap:AMP.setState({ crox: ((crox != '{256') ? '256' : '256')}),croxform.submit" />
On each page, 100 of these checkboxes are generated and group ids belong to categories and crox ids are post ids. when a checkbox is selected the post id is sent to the croxform.
Now, before AMP, I was able to make sure that only 1 checkbox from a given group (either 1 or 2 or any other amount of groups) could be selected at any given time using the javascript code below
$('input[type="checkbox"]').on('change', function() {
$('input[name="' + this.name + '"]').not(this).prop('checked', false);
});
It’s a jquery script and i’m trying to use amp-script to apply the same method on an amp page. however, till now i have been unsuccessful on all my tries as I’ve gone through all the questions and answers on stackoverflow, google search. can someone help me out with the problem?
if anyone can think of a way, then is it possible to have on=”change:AMP.setState” to apply to this case?
- The topic ‘amp-script problem’ is closed to new replies.