WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
UNCONFIRMED
57819
Radio Button checked state is removed after appending it dynamically via javascript several times
https://bugs.webkit.org/show_bug.cgi?id=57819
Summary
Radio Button checked state is removed after appending it dynamically via java...
maximilian.zimmer
Reported
2011-04-05 01:38:44 PDT
I'm currently working on a form-intensive site that lets people edit previously submitted forms that have been dynamically added to the page via javascript (unfortunately I don't have an url to demonstrate the behavior). I'm using jQuery 1.5.1 and the behavior only occurs in webkit based browsers. On edit I loop through a set of radio buttons, verify which one is checked and create a new element for each radio button with the checked one having the checked attribute set to checked and append them to the new form (example code: answer.append('<input type="radio" name="correct-edit" ' + checked + ' />');). On save the same happens in a reverse way, I loop once again through the radio buttons, recreate them with the currently checked one set checked="checked" and append them (example code: $('<div class="answer"></div>').append('<input type="radio" ' + checked + ' disabled="disabled" /><label>' + answer_text + '</label>');). Repeating the edit/save process 3 times (edit then save, edit then save, edit) causes the checked state of the radio button that is supposed to be checked to disappear, although inspecting the element shows that the checked attribute is still set to checked. This happens both when leaving the the checked radio button the same or selecting different radio buttons. When retrieving the value of the checked attribute it shows through for the first two edits and false for the third, even though the attribute appears as checked in the source code. This also happens regardless of whether the radio buttons have a name attribute or not. Here is a link to a post from someone in the jquery forum that seems to have the same/similar problem and found a (non-ideal) workaround:
http://forum.jquery.com/topic/answer-injecting-radio-buttons-in-webkit
Attachments
Add attachment
proposed patch, testcase, etc.
Alexey Proskuryakov
Comment 1
2011-04-05 11:39:39 PDT
See also:
bug 45719
(duplicate?)
Alexey Proskuryakov
Comment 2
2011-04-05 11:40:10 PDT
Could you please attach a complete test case with definitive PASS/FAIL results?
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug