You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had written html with a group of radio buttons, in which I had added checked attribute to first radio button to make it checked by default when view is rendered. On the same form on change event of another element I had called copyViewValuesToModel function.After adding the call I find that the radio which had checked attribute gets checked though if I had changed the selection in radio button group.On debugging I found on line 303 of backbone.modelbinder.js the code is
if(el.attr('type') === 'radio' && el.attr('checked')) which should be
if(el.attr('type') === 'radio' && el.is(':checked')). Correct me if I am wrong.
The text was updated successfully, but these errors were encountered:
technikhil314
changed the title
if called copyViewValuesToModel the radio which is default checked in html gets checked and model gets the value.
If called copyViewValuesToModel the radio button with checked attribute in html gets checked and model gets the value.
Jan 24, 2015
I would favor el.prop('checked') myself, but I agree that el.attr('checked') seems fishy/off there. If you get a chance, would you mind seeing if using prop will work too?
Did you want to open a pull request to fix this, or would you like me or someone else to do so?
I had written html with a group of radio buttons, in which I had added checked attribute to first radio button to make it checked by default when view is rendered. On the same form on change event of another element I had called copyViewValuesToModel function.After adding the call I find that the radio which had checked attribute gets checked though if I had changed the selection in radio button group.On debugging I found on line 303 of backbone.modelbinder.js the code is
if(el.attr('type') === 'radio' && el.attr('checked')) which should be
if(el.attr('type') === 'radio' && el.is(':checked')). Correct me if I am wrong.
The text was updated successfully, but these errors were encountered: