Title: amp-script problem
Last modified: March 29, 2020

---

# amp-script problem

 *  Resolved [germanshephard](https://wordpress.org/support/users/germanshephard/)
 * (@germanshephard)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/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?

Viewing 1 replies (of 1 total)

 *  Plugin Author [Weston Ruter](https://wordpress.org/support/users/westonruter/)
 * (@westonruter)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/amp-script-problem/#post-12596931)
 * I don’t see any `amp-script` being used here, but rather just `amp-bind` and 
   AMP Actions/Events.
 * Nevertheless, this is a general question about AMP which isn’t specific to the
   AMP plugin. Therefore it is better asked on Stack Overflow: [https://stackoverflow.com/questions/tagged/amp-html](https://stackoverflow.com/questions/tagged/amp-html)
 * For other support channels, see [https://amp.dev/support/](https://amp.dev/support/)

Viewing 1 replies (of 1 total)

The topic ‘amp-script problem’ is closed to new replies.

 * ![](https://ps.w.org/amp/assets/icon.svg?rev=2527602)
 * [AMP](https://wordpress.org/plugins/amp/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/amp/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/amp/)
 * [Active Topics](https://wordpress.org/support/plugin/amp/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/amp/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/amp/reviews/)

## Tags

 * [custom javascript](https://wordpress.org/support/topic-tag/custom-javascript/)

 * 1 reply
 * 2 participants
 * Last reply from: [Weston Ruter](https://wordpress.org/support/users/westonruter/)
 * Last activity: [6 years, 2 months ago](https://wordpress.org/support/topic/amp-script-problem/#post-12596931)
 * Status: resolved