Jquery function not defined
You forgot the function() after ready()
should be:
$(document).ready(function() {
function spouseName() { // your code }
function anotherFunction() { }
});
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
});