Sarath Sivan
Sarath Sivan

Reputation: 1

Uncaught ReferenceError: $ is not defined in a jquery function

I had been getting this message when I use a JavaScript function for the onchange event of a select option.

The function is:

<script type="text/javasript" src="jquery.min.js"></script>
<script type="text/javascript">
function desigchanged()
{
    
    $.get('jqueryphp.php?desig=wr',update);
}
function update(res)
{
    $('#inpt4').html(res);
}
</script>


<select id="inpt3" name ="designatn" onChange="desigchanged();">
            <option value="pm" selected>project manager</option>
            <option value="wr">worker</option>
            </select><BR><BR>
            <label><font id="fnm">Gender</font></label>
            <label><font id="fnm3">Male</font></label>
            <input name="gender" type="radio" id="inpt11" value="Male" />
            <label><font id="fnm4">Female</font></label>
            <input name="gender" type="radio" id="inpt22" value="Female" /><BR><BR>
            <label><font id="fnm">Works Under</font></label>
            <select name="wrkundr" id="inpt4">
            </select>

The jQuery file is included properly. Please someone help me.

Upvotes: 0

Views: 2026

Answers (2)

pimvdb
pimvdb

Reputation: 154818

I suspect it's because of the typo:

type="text/javasript"

Note the missing "c" in "script". Browsers won't execute a script tag if its type attribute hasn't been defined correctly.

Upvotes: 2

footy
footy

Reputation: 5911

Edit:

But you may also be facing this problem (absolute/relative paths).

And

You also have a typo for javascript

Original:

have you done this

You should put the references to the jquery scripts first.

Or

This?

Maybe you are calling the ready function before the JQuery Javascript is included?

Upvotes: 0

Related Questions