jQuery - function .prop ()

1

I have a input that is disabled by default, however I wanted to enable it in loading the page through jQuery, but it is not working.

Code of input :

<input type="text" title="Número" name="billing[street][2]" id="billing:street2" class="input-text required-entry" value="" autocomplete="off" disabled="">

I tried the code below but did not succeed:

$j(document).ready(function(){
    $j('#billing:street2').prop('disabled',false);
})
    
asked by anonymous 23.09.2017 / 15:36

1 answer

2

When you need to use special characters in your seletor , you must use \ (two backslashes), so that the character is treated as text and not as a regular expression. Another error contained in your code is the j character after $ .

$(document).ready(function(){
    $("#billing\:street2").prop('disabled',false);
});
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script><inputtype="text" title="Número" name="billing[street][2]" id="billing:street2" class="input-text required-entry" value="" autocomplete="off" disabled="">

Learn more about seletores here .

    
23.09.2017 / 16:05