$(window).load(function() { : Uncaught TypeError: $ is not a function

I have an Eloqua form embedded on our site and am getting this error:Uncaught TypeError: $ is not a function. I have tried swapping out for jquery onload but still getting errors.

Full code here:

<div>
<form method=”post” name=”Brand&Demand_Newsletter_Signup”
action=”https://s1544.t.eloqua.com/e/f2″ onsubmit=”return validateForm()”
class=”elq-form” >
<input value=”Brand&Demand_Newsletter_Signup” type=”hidden”
name=”elqFormName” />
<input value=”1544″ type=”hidden” name=”elqSiteId” />
<input name=”elqCampaignId” type=”hidden” />
<div id=”formElement0″ class=”sc-view form-design-field sc-static-layout sc-
regular-size” style=”left: 0px; right: 0px; top: 0px; bottom: 0px; padding:
6px 5px 9px 9px”>
<div class=”field-wrapper”></div>
<div id=”formElement2″ class=”sc-view form-design-field sc-static-layout sc-
regular-size” style=”left: 0px; right: 0px; top: 0px; bottom: 0px; padding:
6px 5px 9px 9px” >
<div class=”field-wrapper” ></div>
<div class=”field-wrapper” style=”float: left; width: 100%; clear: both” >
<div class=”_100″ style=”float: left; width: 96%; margin-right: 2%; margin-
left: 1.8%” >
<p style=”position: relative; margin: 0px; padding: 0px” >
<label for=”field2″ style=”display: block; line-height: 150%; padding: 1px
0pt 3px; float: left; width: 10%; margin: 0pt 15px 0pt 15px; word-wrap:
break-word” >Name</label>
<input id=”C_FirstName” name=”C_FirstName” class=”form-control
elqFormFieldLabel” type=”text” value=”” style=”width: 52.1%” /></p>
</div>
</div>
</div>

<div class=”field-wrapper” style=”float: left; width: 100%; clear: both” >
<div class=”_100″ style=”float: left; width: 96%; margin-right: 2%; margin-
left: 15px” >
<p style=”position: relative; margin: 0px; padding: 0px” >
<label for=”field0″ style=”display: block; line-height: 150%; padding: 1px
0pt 3px; float: left; width: 10%; margin: 0pt 18px 0pt 0pt; word-wrap:
break-word” >
<span style=”margin-right: -30px;”> Email </span></label>
<input id=”C_EmailAddress” name=”C_EmailAddress” class=”form-control
elqFormFieldLabel” type=”text” value=”” style=”width: 50.8%” /> </p>
</div</div></div>
<div id=”formElement1″ class=”sc-view form-design-field sc-static-layout sc-
regular-size” style=”left: 0px; right: 0px; top: 0px; bottom: 0px” >
<div class=”field-wrapper” >
</div>
<div class=”field-wrapper” style=”float: left; width: 100%; clear: both” >
<div class=”_100″ style=”float: left; width: 96%; margin-right: 2%; margin-
left: 2%” >
<p style=”position: relative; margin: 0px; padding: 0px” >
<input id=”field1″ type=”hidden” name=”hiddenCampaignId” value=” ” />
</p>
</div>
</div>
</div>

<div id=”formElement3″ class=”sc-view form-design-field sc-static-layout sc-
regular-size” style=”left: 0px; right: 0px; top: 0px; bottom: 0px; padding:
6px 5px 9px 9px” >
<div class=”field-wrapper” >
</div>
<div class=”field-wrapper” style=”float: left; width: 100%; clear: both” >
<div class=”_100″ style=”float: left; width: 96%; margin-right: 2%; margin-
left: 2%” >
<p style=”position: relative; margin: 0px; padding-top: 20px” >
<input type=”submit” value=”Tell Me How” id=”btn-submit” class=”submit-
button” style=”height: 24px; width: 100px” />
</p>
</div>
</div>
</div></form>
<script src=”https://img.en25.com/i/livevalidation_standalone.compressed.js”
type=”text/javascript” >
</script>
<script type=”text/javascript”>
$(window).load(function() {
// Animate loader off screen
$(“.se-pre-con”).fadeOut(“slow”);;
});
function validateForm() {
var x = document.forms[“Brand&Demand_Newsletter_Signup”]
[“C_FirstName”].value;
if (x == null || x == “”) {
alert(“Please fill your First Name!”);
return false;}
var x = document.forms[“Brand&Demand_Newsletter_Signup”]
[“C_EmailAddress”].value;
if (x == null || x == “”) {
alert(“Please fill your Email ID!”);
return false;}
var x = document.forms[“Brand&Demand_Newsletter_Signup”]
[“C_EmailAddress”].value;
var atpos = x.indexOf(“@”);
var dotpos = x.lastIndexOf(“.”);
if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length) {
alert(“Not a valid e-mail address!”);
return false;}
var x = document.forms[“Brand&Demand_Newsletter_Signup”][“C_Title”].value;
if (x == null || x == “”) {
alert(“Please fill your Title!”);
return false;
}var x = document.forms[“Brand&Demand_Newsletter_Signup”]
[“C_Company”].value;
if (x == null || x == “”) {
alert(“Please fill your Company Name!”);
return false;
}}
</script>
<script type=”text/javascript”>
jQuery(document).ready(function($){
$(‘#btn-submit’).click(function() {
$(“.error”).hide();
var hasError = false;
var emailReg = /^([w-.]+@([w-]+.)+[w-]{2,4})?$/;
var emailblockReg =
/^([w-.]+@(?!gmail.com)(?!yahoo.com)(?!hotmail.com)(?!yahoo.co.in)
(?!aol.com)(?!live.com)(?!outlook.com)(?!me.com)(?!msn.com)(?!ymail.com)
([w-]+.)+[w-]{2,4})?$/;
var emailaddressVal = $(“#C_EmailAddress”).val();
/*if(emailaddressVal == ”) {
$(“#C_Email”).after(‘<span class=”error”>Please enter your email address.
</span>’);
hasError = true;
}
else if(!emailReg.test(emailaddressVal)) {
$(“#C_Email”).after(‘<span class=”error”>Enter a valid email address.
</span>’);
hasError = true;
}else */
if(!emailblockReg.test(emailaddressVal)) {
$(“#C_Email”).after(‘<span class=”error”>Please Enter Business Email
Address</span>’);
hasError = true
}

if(hasError == true) { return false; }

});
});
</script>
</div>

Hoping someone can take a look @ the code and let me know if something is conflicting as I am a beginner in JavaScript.

Thank you in advance.

Read more here:: $(window).load(function() { : Uncaught TypeError: $ is not a function

Leave a Reply

Your email address will not be published. Required fields are marked *