Im trying to disable an input after a condition and i dont understand why this not working. I tried to use $("#exemplaire_50001_0").attr('disabled', true);
and $("#exemplaire_50001_0").prop('disabled', true);
but both are changing nothing. Im using Jquery 1.5.1 so i think .attr
must be used.
When i add
$("#exemplaire_50001_0").css("background-color", "red");
to my selector so the background is changing to red.
My question is, why the .css
working but the .prop
or .attr
is not ? Where is the problem come from ? Is there an other solution to disable an input with jquery ?
Code :
var test = $('#num_cppap').val();
var test2 = test.substr(0,3);
console.log(test2);
if(test2 == "AIP"){
$("#exemplaire_50001_0").css("background-color", "red");
$("#exemplaire_50001_0").attr('disabled', true);
}
html ( this how i build the html ( using ZendFramework ) ) :
Nav render :