Special Offer - Get $90 Discount and Host Your Dream Web Site @ Dreamhost for 1 Year Click Here. Promo Code SLJ345
Back To Top
WordPress Web Application Development
Develop Powerfull Web Applications Using Cutting Edge WordPress Development Techniques

Highlight Links in a Web Page using Jquery Selectors and CSS Functions

on 2011/06/7 8:07 AM stored in: Uncategorized and tagged:

How to Find Links using Jquery

Using jquery selectors we can easily find html links inside a given web page. there are 3 types of selectors mainly in jquery. In this example I’m going to use tag based selector to find links with href attribute.

 

Jquery Selectors

1. ID Selector – $(‘#id’)
2. Class Selector – $(‘.class’)
3. Tag Selector – $(‘a’)

 

Selecting Links with href Attribute


        


In the above code all ‘’ tags are selected using the tag selector. Also i have used the href attribute to find the tags. Then we can traverse through each link. The links are activated when you click on the button with the id link.

Highlight Link Text using Jquery and CSS Classes

We need to change the background color of links in order to highlight. So we need to change the css styles of the links to provide colors. Jquery addClass method allows you to change the current css class of an element. Here we can change the class to a specific class with background colors as shown below.

        

Download Highlight Link Demo

Download Demo

Leave a Reply

Follow Us On Facebook