jQuery attribute disable not working -


i'm try disable (and remove) attributes in jquery, seems not working when value changed , set "disabled" fields. script runs when value of drop-down box changed.

here code below:

$(".tipo_frete").change(function(){     if($(this).val()  == "fob" ){         $(".id_transp").attr("disabled");         $(".id_transp").val("");         $(".nome_transp").attr("disabled");         $(".nome_transp").val("");         $(".valor_frete").attr("disabled");                              $(".valor_frete").val("");                           }else{         $(".id_transp").removeattr("disabled");         $(".valor_frete").removeattr("disabled");                    $(".nome_transp").removeattr("disabled");                } }); 

did wrong here?

in jquery when want attribute value, must use .attr('key') or .prop('key') 1 argument, when want set value attribute, must set 2 arguments .attr('key', 'value') or .prop('key', 'value')

$(".id_transp").attr("disabled", "disabled");  //or  $(".id_transp").prop("disabled", true); 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -