ion.checkRadio icon indicating copy to clipboard operation
ion.checkRadio copied to clipboard

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

Open cnsgithub opened this issue 7 years ago • 0 comments

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>

cnsgithub avatar Jun 01 '17 08:06 cnsgithub