Here i got a problem in my script,
Once we set one radio button we cannot change it anymore :
$("#divAddNewNote").click(function() {
if ($("#divAddNewNote textarea").length == 0) {
$("#divAddNewNote div").css("display", "none");
box += "<div class=\"noteBottomBar\">";
box += " <div class=\"radioPrivatePublic\">";
box += " <input type=\"radio\" id=\"radio1\" name=\"groupPrivate\" value=\"private\" /><label for=\"radio1\">Private</label>";
box += " <input type=\"radio\" id=\"radio2\" name=\"groupPrivate\" value=\"public\" /><label for=\"radio2\">Public</label>";
box += " </div>";
box += " <button onclick=\"ajaxSaveNewStatus(10886);\">Post</button>";
box += "</div>";
$("#divAddNewNote").append(box);
return false;
} else {
return false;
}
});
It’s a problem in my javascript code but i cannot find it
The problem is that your radio buttons are within
#divAddNewNote. Your click handler for#divAddNewNotereturns false. returning false in a jquery event handler has 2 functions. It is equivalent toevent.preventDefaultandevent.stopPropagation. The important one here is thepreventDefault. This is causing your attempt to change the value of the radio button to be canceled (“prevented”).