I have a problem with loading this code. I am sure its something to do with noConflict but i cant seem to get it right.
$(document).ready(
function spouseName() {
if ($('#maritalstatus').val() == 'married') {
$('#spousename').attr("disabled", false);
} else {
$('#spousename').val('');
$('#spousename').attr("disabled", true);
}
}
);
by the way, it works on IE but not FF
thanks for the info and answers, it seems this thread helped
Function not defined
firefox does not recognize the function name when it inside the jquery document.ready function. what i did was wrap it inside although it seems unconventional. I just removed the document ready and it works perfectly. seems chrome and FF dont recognize function names within this?
function spouseName() {
if ($('#maritalstatus').val() == 'married') {
$('#spousename').attr("disabled", false);
}
else {
$('#spousename').val('');
$('#spousename').attr("disabled", true);
}
}
The "jQuery not defined" error happens if you have not included jQuery or may imported beneath your JavaScript.
It should be like this:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"> </script>
<script type="text/javascript" src="myjsfile.js"> </script>
myjsfile.js
should be like this:
$(document).ready(function(){
every function inside this
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With