






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
E-Commerce is taking over the traditional commerce practices. It is of special concern for the IT students. Following are the key points of these Lecture Slides : Selector Extensions, Javascript, Library, Animation, Referencing Page, Javascript Extensions, Libraries, Script Statement, Custom Mechanism, Document Complete
Typology: Slides
1 / 10
This page cannot be seen from the preview
Don't miss anything!







1
JavaScript library with DOM-like and BOM-like functions. Offers effects (visual, animation)
Download (or link to external) jQuery script. http://jquery.com/
2
Load the other libraries first in your code. Load jQuery. Execute the script statement “jQuery.noConflict()” In lieu of $() use jQuery() in jQuery-related code.
The above illustrates a common jQuery design pattern—use of an anonymous callback function as a parameter. Watch symbol ordering at end of sequence!
4
http://einstein.etsu.edu/~pittares/CSCI3110/examples/11-1.htm
http://einstein.etsu.edu/~pittares/CSCI3110/examples/11-2.htm
$(selector). click (function() { function body here });
http://einstein.etsu.edu/~pittares/CSCI3110/examples/11-3.htm
http://einstein.etsu.edu/~pittares/CSCI3110/examples/11-3a.htm
5
toggle: takes in 2 functions and does function 1 on first click, function 2 on second click, then back to function 1, etc. $('hh').toggle(function() { function body here }, function() { function body here }); http://einstein.etsu.edu/~pittares/CSCI3110/examples/11-4.htm hover: same pattern, just change function name http://einstein.etsu.edu/~pittares/CSCI3110/examples/11-4a.htm
http://einstein.etsu.edu/~pittares/CSCI3110/examples/11-5.htm
http://einstein.etsu.edu/~pittares/CSCI3110/examples/11-6.htm
7
$(selector).attr(“attribute”)—retrieves the attribute value from selector $(selector).attr(“attribute”, “value”); $(selector).attr({“attribute”: “value”, “attr”: “val”…}); --sets attribute/value pairs on selector http://einstein.etsu.edu/~pittares/CSCI3110/examples/11-10.htm
$(sel).click(function( event ) { other code here; event .stopPropagation(); }); http://einstein.etsu.edu/~pittares/CSCI3110/examples/11-11.htm
8
$(“
This is a new paragraph
”) When HTML code is placed within $, that element is created automatically. The item is not automatically added to the page. To add, use $(‘elem’).insertBefore(sel) $(‘elem’).insertAfter(sel), $(‘sel’).append(‘elem’) $(‘sel’).prepend(‘elem’) http://einstein.etsu.edu/~pittares/CSCI3110/examples/11-12.htmDon’t forget # if an ID!
$(sel).eventType(function(event) { }); $(this) event.stopPropagation();
10
$(html) $(‘elem’).insertBefore(sel) $(‘elem’).insertAfter(sel), $(‘sel’).append(‘elem’) $(‘sel’).prepend(‘elem’)