mardi 21 juillet 2015

Not able to remove disable property of button using jQuery

I have a set of check-boxes only one of them will be checked at a time. (I need check-boxes here not radio buttons). There is a disabled button in the same page.

I am trying to remove the disabled property of button upon clicking a checkbox.

Unfortunately, it didn't work.

HTML

<input type="checkbox" name="group2[]" class="me" data-btname="xxxx" />
<input type="checkbox" name="group2[]" class="me" data-btname="xxxx" />
<input type="checkbox" name="group2[]" class="me" data-btname="xxxx" />

<input type="button" name="aa" id="xxxx" value="this is me" disabled />

jQuery

$('.me').on('change', function() {
    $('input[name="' + this.name + '"]').not(this).prop('checked', false);
    var buton_namee = $(this).attr('data-btname');
    //alert(buton_namee);
    $('#buton_namee').removeAttr('disabled');
});

Fiddle




Aucun commentaire:

Enregistrer un commentaire