I am getting error jquery is not defined.. please help me..
jQuery(function(){
jQuery('#submitid').click(function(){
if(jQuery('input[id="EnrollmentServiceAddress1"]').val() != ''){
var add2 = jQuery('input[id="EnrollmentServiceAddress2"]').val();
if(add2.indexOf('#', 0) && add2 != ''){
jQuery('input[id="EnrollmentServiceAddress2"]').val('#'+add2);
}
}
QadServer.current.submit("#EnrollmentServiceInformationForm");
});
jQuery('input[name="residence_type"]').click(function() {
if(jQuery('input[name="residence_type"]:checked').val() == 'home') {
// jQuery('#add_type').html('Home Number');
jQuery('#home_apt').slideUp('slow');
} else if(jQuery('input[name="residence_type"]:checked').val() == 'apartment') {
jQuery('#add_type').html('Apartment Number');
jQuery('#home_apt').slideDown('slow');
}
});
jQuery('.qad_suggestion').live('click',function() {
qad_test();
});
jQuery('div[id="change_add"] > span').click(function() {
jQuery('input[id="EnrollmentServiceAddress1"]').val('');
jQuery('input[name="residence_type"]:checked').attr('checked', false);
jQuery('#home_apt').hide();
jQuery('#change_add').slideUp('slow', function() {
jQuery('#validate_add_block').slideDown('slow');
});
});
<?php if($this->Session->check('Enrollment.social_security_number')) { ?>
// jQuery('#validate_add_block').hide(); //Old code
// jQuery('#change_add').show();
jQuery('#validate_add_block').show(); //New code
jQuery('#change_add').hide();
<?php } ?>
init();
});
I am getting error jquery is not defined.. please help me..
jQuery(function(){
jQuery('#submitid').click(function(){
if(jQuery('input[id="EnrollmentServiceAddress1"]').val() != ''){
var add2 = jQuery('input[id="EnrollmentServiceAddress2"]').val();
if(add2.indexOf('#', 0) && add2 != ''){
jQuery('input[id="EnrollmentServiceAddress2"]').val('#'+add2);
}
}
QadServer.current.submit("#EnrollmentServiceInformationForm");
});
jQuery('input[name="residence_type"]').click(function() {
if(jQuery('input[name="residence_type"]:checked').val() == 'home') {
// jQuery('#add_type').html('Home Number');
jQuery('#home_apt').slideUp('slow');
} else if(jQuery('input[name="residence_type"]:checked').val() == 'apartment') {
jQuery('#add_type').html('Apartment Number');
jQuery('#home_apt').slideDown('slow');
}
});
jQuery('.qad_suggestion').live('click',function() {
qad_test();
});
jQuery('div[id="change_add"] > span').click(function() {
jQuery('input[id="EnrollmentServiceAddress1"]').val('');
jQuery('input[name="residence_type"]:checked').attr('checked', false);
jQuery('#home_apt').hide();
jQuery('#change_add').slideUp('slow', function() {
jQuery('#validate_add_block').slideDown('slow');
});
});
<?php if($this->Session->check('Enrollment.social_security_number')) { ?>
// jQuery('#validate_add_block').hide(); //Old code
// jQuery('#change_add').show();
jQuery('#validate_add_block').show(); //New code
jQuery('#change_add').hide();
<?php } ?>
init();
});
Share
Improve this question
asked Apr 25, 2012 at 7:06
FrontEnd ExpertFrontEnd Expert
5,81310 gold badges63 silver badges100 bronze badges
5
- have you add jquery reference url? add this link to your head <script src="jquery./src/jquery-latest.js"></script> – Rony SP Commented Apr 25, 2012 at 7:07
-
couple of things to check: 1. is your
<script src="jquery.js></script>
before those wall of script? 2. are you enclosing that script inside a$(function() { })
? – Andreas Wong Commented Apr 25, 2012 at 7:07 -
@NiftyDude
$(function() { })
can't be a solution because for $ jQuery must already be loaded. – PiTheNumber Commented Apr 25, 2012 at 7:14 - yes i added.. i checked in vie source also – FrontEnd Expert Commented Apr 25, 2012 at 7:40
- Maybe you can show us more? Link to page, the include, ... – PiTheNumber Commented Apr 25, 2012 at 7:54
5 Answers
Reset to default 3Erro is because jquery file is not loading properly to avoid this Try following code which include the jquery if its not included in your page ...
<script type="text/javascript">
/******** Load jQuery if not present *********/
if (typeof jQuery === "undefined" || jQuery.fn.jquery !== '1.4.2')
{
var script_tag = document.createElement('script');
script_tag.setAttribute("type","text/javascript");
script_tag.setAttribute("src", "http://ajax.googleapis./ajax/libs/jquery/1.4.2/jquery.min.js")
document.getElementsByTagName("head")[0].appendChild(script_tag);
}
}
$(document).ready(function() {
alert('jQuery Library Loaded');
});
</script>
try
jQuery.noConflict()
else try to replace $ with jQuery
.
Put this line at the top of your jquery code
jQuery.noConflict();
Have you included jQuery?
<script type="text/javascript" src="jquery.js"></script>
or
<script type="text/javascript" src="http://ajax.googleapis./ajax/libs/jquery/1.7.2/jquery.min.js"></script>
http://docs.jquery./Tutorials:Getting_Started_with_jQuery
try this in your view file
<?php $this->Js->JqueryEngine->jQueryObject = 'jQuery'; ?>