Reputation: 69
I want ask you for help. I have form, where I change id by check-boxes:
<input id="SP_sid" type="hidden" name="sid" value="" />
<!--radio-->
<input name="sid_id" type="radio" value="1">One</input>
<input name="sid_id" type="radio" value="2">Two</input>
<!--script-->
<script>
jQuery('input[name="sid_id"]').click(function() {
jQuery('#SP_sid').val(this.value);
});
</script>
but I need to have value of sid
from beginning pre-set to "1".
If I put "1" to value of sid
, I am not able to change it by script to "2".
Is there any easy solution to get it work like this?
Upvotes: 0
Views: 184
Reputation: 152294
You can try with:
jQuery('input[name="sid_id"]').change(function() {
jQuery('#SP_sid').val(jQuery(this).val());
});
Upvotes: 1