Object Oriented Scripting

One of the classes we offer in the web and graphic design program at the Art Institute of Dallas is the Object Oriented Scripting class. We are hoping to use jQuery to demonstrate basic principles of JavaScript objects, including properties, methods, and inheritance. jQuery is a neat JavaScript library that is especially good at manipulating the HTML structure of a page and changing the CSS on the fly. It uses selectors in a similar fashion to CSS. For example to select an element that has the id=”para”, jquery would do something like this:

$(‘#para’).hide();

The $ is simply a variable that represents the jquery object. You could instead type

jquery(‘#para’).hide(); *see my note at bottom

but using the $ instead of jquery is much faster.

Notice the parenthesis that come after $

$(‘#para’)

they contain the selector. In this case we are selecting the element that has the id of para. jQuery will then do something with that element. (An element is another way to say a tag.)

Once jQuery has selected the element it will do something to it. In this case we call the hide method to hide the element. It will disappear!

You can learn more about JavaScript and jQuery along with HTML5, CSS, and JavaScript in our graphic and web design major at AI Dallas. Feel free to contact me for more information: dprince@aii.edu

*to perform this same action in JavaScript you would do:

var para = document.getElementById(‘para’);
para.style.display=’none’;