lundi 20 juillet 2015

Trying to create a disab

I'm trying to code a text field that is disabled when the check box is 'checked'.

Below is the code I'm using. I have no bloody idea why it's not working. I suspect it may be WordPress' fault but I'm new to Javascript so I'm hoping it's that.

<script type="text/javascript">
$('input[name=AddressCheck]').change(function(){
    if($(this).is(':checked')) {
        $("#dbltext").removeAttr('disabled');
    }
    else{
       $("#dbltext").attr('disabled','disabled');
    }    

});
</script>



<input name="AddressCheck" type="checkbox" id="AddressCheck" /><br />
<input type="text" id="dbltext" disabled/>




Aucun commentaire:

Enregistrer un commentaire