- One of JQuery's most Powerful features is its ability to chain multiple functions together.
- We can perform Several Operations in 1 line of Code.
- Here the result set is an collection on function1,function2,function3 annotated together by a dot operator.
- They will chain from left to right.
- So with this bulk result set we can perform any operations of our wish like we can apply a selector or apply an filter etc.
- Jquery terminology call this 'statement chaining'
- Instead of getting the result set over & over again, we use the same result set.
- We can apply a css to identify the selected result set.
Statement Chaining Example:
- We illustrate statement chaining with an icon identifier example.
- We have a set of 5 links in the example and some of them are html links some pdf links and some email links.
- Using Jquey we select all the anchor tags and look for the ones with the extension '.pdf' to it.
- Then we add a small icon to show that it's a pdf link.
- Live demo and script download is available below
Statement Chaining in JQuery
The below Example demonstrates how to examine content of a link and add a pdf icon to it if its pdf.
An Screnshot is given below:
Download & Live Demo:
- Click below to download Script and view 'Live Demo'
Before Concluding I would like to inform the readers that our site has attained google page rank 1 in the rank update by google.Big thanks for all your support !
Thank u for reading this Article hope it was useful !