I try to toggle text box on checkbox's click event and it working fine. My Issue is that I also want to change checkbox's required attribute.
Here is my code which will remove required attribute but can not toggle it.
$('#sender_name').change(function(event){
if ($('#sender_name').attr('required', 'required'))
{
$('#sender_name').removeAttr('required', 'required');
}
else
{
$('#sender_name').attr('required', 'required');
}
$('.sender_name_text').toggle();
});
Using this code, checkbox's attribute will removed, but not appy again. check it in fiddle by inspect element.
Here Is Fiddle Link
-- Regards
Aucun commentaire:
Enregistrer un commentaire