Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

how to get visible status of anchor tag using Jquery

Posted on 2013-06-11
2
Medium Priority
?
1,540 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 10

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 1500 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

The most up-to-date version of this article is on my Blog https://iconoun.com/blog/
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 how to dynamically set the form action using jQuery.
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…

721 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