Link to home
Create AccountLog in
Avatar of sabecs
sabecs

asked on

jQuery - check radio button

Is there a way to check a radio button if a match is found in a list of stores but check first store listed if no match is found.

For example if store_id = 3 , I want to check radio button with id="store_3"

For example if store_id = 2 , no match found so check radio button with id="store_1"

For example if store_id = 5 , no match found so check radio button with id="store_1"

Thanks,

Andrew


<div id="list_stores" >

<div class="show_pickup_stores" id="show_pickup_store_1" >
<input name="store_id" type="radio" onClick="set_store_id(this.value);"  id="store_1" value="1"><label for="store_1">Head Office</label>
</div>

<div class="show_pickup_stores" id="show_pickup_store_3" >
<input name="store_id" type="radio" onClick="set_store_id(this.value);"  id="store_3" value="3"><label for="store_3">Warehouse Store</label>
</div>

</div><!-- end of store list -->

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of soupBoy
soupBoy
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of sabecs
sabecs

ASKER

Thanks soupBoy, that is perfect..