Solved

how to get visible status of anchor tag using Jquery

Posted on 2013-06-11
2
1,380 Views
Last Modified: 2013-06-17
Hi,
I have code like this, on some conditions I make the link visible=false,visible=true in code.
I need to get the visible status of the anchor control in Jquery. I have tried could not get any solution.

   <ul runat="server" id="menubar">
        <li><a href="~/test" id="mnuTest" runat="server">Test</a></li>
        <li><a href="~/test1" id="mnuTest1" runat="server">Test1</a></li>
      </ul>
0
Comment
Question by:Loganathan Natarajan
2 Comments
 
LVL 9

Expert Comment

by:Ishaan Rawat
ID: 39237490
Try this...
if( $('a').is(':visible') ) {
    // it's visible, do something
}
else {
    // it's not visible so do something else
}

Open in new window

0
 
LVL 15

Accepted Solution

by:
Jagadishwor Dulal earned 500 total points
ID: 39237841
You have multiple anchor links so you will need each function

$(document).ready(function() {
	$('a').each(function(){ 
		if($(this).is(':visible') ) {
			//Visible 
}
else {
    // not visible so do something else
}
	});
});

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

948 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now