Solved

how to get visible status of anchor tag using Jquery

Posted on 2013-06-11
2
1,362 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
Comment Utility
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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

There are a couple ways to attach a JavaScript function to dynamically created elements. You can make a new script for each element as it’s created or you can use delegation. Delegation allows a single script that is added at page creation to mat…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
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…

763 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

6 Experts available now in Live!

Get 1:1 Help Now