Can't find error with FireBug
I founded a error in jQuery, with my code.
I can't understand the origin of this error:
-
b is undefined
There is the two files used:
scripts.js
- /**
* Lollabot JQuery
* last update: 10/09/2010
*/
/*
<script type="text/javascript" src="js/jquery.js"></script>
*/
/*** jQuery Use Cases *********/
//1- Selector: google 'css3 selectors'
$('.title');
$('.title-id');
$('[src]');
$('[src$=jpg]');
$('h3:hidden');
$('.title:nth-child(3)');
$(':not(:first)');
//2- Create element
$('<h3>Hello!</h3>').appendTo('body');
//3- Variables
$.browser.msie;
$.browser.mozilla;
$.support;
/*** jQuery and Forms *********/
$('.form-radios input:checked');
$('#test :selected');
/*** jQuery and Effects ************/
$('#test').hide();
$('#test').animate({"fonteSize":"44px", "letterSpacing":"-2px"});
/*** jQuery Events *****************/
//Entier program
$(document).ready(function() {
function myClick() {
console.log(this);
alert('Hello!');
}
$('#test').click(myClick);
// Or
$('#test').css('cursor','pointer').bind('click', myClick);
$('#test').unbind('click', myClick);
});
//General bind() [short function]
$('#test').bind('click.myClick', function() {
alert('Hello word');
});
$('#test').unbind('click.myClick');
/*** JQuery find elements *****************/
//1 basic
function myClick() {
$(this).parent().children('div.content').slideToggle();
}
$('h3').unbind('click', myClick);
//Mouse hover
$('h3').mouseenter().css('color', 'red');
$('h3').mouseleave().css('color', 'green');
//2 advanced
$('a').click(function(){
console.log(this);
return false;
});
//3- Key code : http://quirksmode.org/js/keys.html
$('a').keypress(function(){
console.log(this);
return false;
});
//4- Form event: blur() # focus() , change(), select(), submit()
/*** jQuery & CSS ***************/
//Class
$('h3').addClass('.test');
$('h3').removeClass('.test');
$('h3').toggleClass('.test');
$('h3').hasClass('.test');
$('h3').css('color', 'red');
//*** jQuery & Manipulation ********************/
$('#test').html('Hello!');
$('#test').html($('#test2').html());
$('#test').wrap('<div class="wrapper"></div>');
$('#test').wrapInner('<div class="wrapper"></div>');
$('#test').unwrap();
//Inside
$('#test').append();
$('#test').prepend();
$('#test').clone().appendTo('.content');
$('#test').prependTo('.content');
//Outside
$('#test').after();
$('#test').before();
$('#test').insertAfter();
$('#test').insertBefore();
//Global
$('#test').empty();
$('#test').remove();
$('#test').detach();
//Replace
$('#test').replaceAll();
$('#test').replaceWith();
//Attribute
$('#test').attr();
$('#test').removeAttr();
$('#test').text();
$('#test').val();
//*** jQuery DOM Traversing ********************************/
(function($){
$('.block .content').hide();
$('.block h3 .title').click(function(){
// 1
$(this).parent().children('.content').slideToggle();
$(this).siblings('.content').slideToggle();
// 2
$(this).parents('div.block:first').find('.content:first').slideToggle();
$(this).closest('div.block').find('.content:first').slideToggle();
});
})(jQuery);
$('html *').click(function(event){
var items = $(this).parents().andSelf().filter('[class^=container_], [class^=grid_]');
event.stopPropagation();
$('.outlined').removeClass('.outlined').css('outline', '');
$(items).addClass('.outlined').css('outline', '1px dashed red');
console.log(items);
});
//Filtering
$('.test').eq();
$('.test').filter();
$('.test').has();
$('.test').is();
$('.test').not();
$('.test').first();
$('.test').last();
$('.test').map();
//*** jQuery & AJAX **************************************/
//Replace 'Read More' Exemple
$('.node_read_more a').click(function(){
var url = $(this).attr('href');
var link = this;
// 1
$.get(url, function(data){
var $fullContent = $('#content-output .content', data);
var html = $fullContent.html();
$(link).closest('div.node').find('div.content').html(html);
$(link).hide();
});
// 2
$.ajax({
url: url,
success: function(data){
var $fullContent = $('#content-output .content', data);
var html = $fullContent.html();
$(link).closest('div.node').find('div.content').html(html);
$(link).hide();
}
});
return false
});
//Special Ajax
$('.conten p').bind('mouseenter mouseleave', function(){$(this).toggleClass('hilight');});
$('.conten p').live('mouseenter mouseleave', function(){$(this).toggleClass('hilight');});
// Plugins
/*
hoverIntent : real hover intention
JQTouch: like iPhone with mouse
Quicksand: cool sorter
DOCUMENTATION TO CREATE PLUGINS: http://docs.jquery.com/Plugins/Authoring
*/
(function($){
jQuery.fn.inspect = function(bindTo) {
if(typeof bintTo == 'undefined'){
bindTo = 'click';
}
$(this).bind(bindTo, function(){
alert($(this).clone().insertAfter(this).wrap('<div></div>').parent().remove().html());
event.stopPropagation();
});
}
})(jQuery);
$(document).ready(function() {
alert('TEST ESEMPLES OK!');
});
-
index.html
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Test Script</title>
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="scripts.js"></script>
</head>
<body>
<h1>TEST</h1>
</body>
</html>