Solved

how to get visible status of anchor tag using Jquery

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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Reactjs with .NET 3 126
Starting to use Git with Visual  Studio Online 1 70
JSON/JQuery/AJAX Error Identification 2 73
Check for Numeric Phone Field 14 48
How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
The viewer will learn how to dynamically set the form action using jQuery.
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)

734 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