ACEAFTY
asked on
jQuery enable checkbox
Hi
I have a disabled checkbox in a table and want to enable it when the edit button is pressed. Not having much luck with this code.
I have a demo version live on: www.afthab.co.uk/test
Thanks in advance
Regards
Ash
I have a disabled checkbox in a table and want to enable it when the edit button is pressed. Not having much luck with this code.
$(".edit").click(function(){
if ($(this).hasClass("save")){
console.log("save");
}else{
console.log("edit");
$(this).closest("tr").find("td").each(function(){
if ($(this).index()!=0 && $(this).index()!=10){
if ($(this).hasClass("delivery")){
$(this).closest("input[type=\"checkbox\"]").prop({
disabled:false
});
}else{
$(this).html("<input type=\"text\" class=\"edit" + $(this).attr('class') + "\" name=\"" + $(this).attr('class') + "\" value=\""+$(this).text()+"\">")
}
}
});
I have a demo version live on: www.afthab.co.uk/test
Thanks in advance
Regards
Ash
$(this).closest("input[typ e=\"checkb ox\"]").pr op('disabl ed',false) ;
ASKER
I tried that but didn't work.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That did the trick, thanks