Skip to content
This repository has been archived by the owner on Jul 1, 2020. It is now read-only.

Change "checked" value of radio group programmatically does not seem to work #20

Open
cnsgithub opened this issue Jun 1, 2017 · 0 comments

Comments

@cnsgithub
Copy link

cnsgithub commented Jun 1, 2017

Hi, I'm looking for a way to change which element of a radio button group is checked via JS. But it doesn't seem to work. The suggested way to trigger a change event doesnt work

http://ionden.com/a/plugins/ion.checkRadio/demo.html

<label class="icr-label">
<span class="icr-item type_radio"></span>
<span class="icr-hidden"><input class="icr-input" type="radio" name="myGroupRadio" value="0" /></span>
				    <span class="icr-text">Metric</span>
				</label>
				  <label class="icr-label">
				    <span class="icr-item type_radio"></span>
				    <span class="icr-hidden"><input class="icr-input" type="radio" name="myGroupRadio" value="1" /></span>
				    <span class="icr-text">Imperial</span>
				</label>

<script>
  $('.icr-input').ionCheckRadio();
</script>

<script>
   //trying to set a first radio to checked via js
   $($(".icr-input")[0]).trigger("change");
</script>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant