<3 JQueryPosted: 2010/07/27
What can i say ? I m lovin it !
Today i ve used JQuery for the first time and wow i m really amazed. It’s soo great. You can acomplish a lot of usefull things soo easily.
You want to find a table and mark a row with an empty column ? No worries.
$(“table[summary=’Some Table’] tr:has(td:empty)”).css(“background-color”, “FF8855”) });
In this example. JQuery first finds table with parameter summary with value Some Table. Then in look for tr’s (table rows) with empty column. After selection it uses css function to apply new style , here its just simple background color.
JQuery works on DOM – Document Object Model. so you have to be sure that document is ready. Every piece of code should be inside special fucntion
Expression like $(….) is a selector. Selectors let’s you query DOM for objects (div , p , a ,table etc.). More info on Selectors …
When you have the object you can change , manipulate it in various ways ….
$(….).hide() – hides object
$(….)css(…) – let’s you add some css style to object.
It’s so simple and easy. It’s so much fun playing around with JQeury.
If you want to taste it a bit , run your favourite Browser open Developer Console and try it.
Open your favourite website and paste this to your navigation bar.