Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (9.5k points)

Below is my HTML code:

<div style="display: none; ">aaa</div>

<a href="#" style="display: none; ">(bbb)</a>

<span style="display: none; ">ccc</span>

I want to remove the attribute of the first HTML <div> tag like below:

<div style="display: none; ">aaa</div>

to

<div>aaa</div>

Can anyone tell me how to do this?

1 Answer

0 votes
by (19.7k points)

If you want to remove it from the first element, you can  use .removeAttr():

$(":first").removeAttr("style");

If you use .show() , it will show the element by removing the display property:

$(":first").show();

Interested in Java? Check out this Java Certification by Intellipaat.  

Related questions

Browse Categories

...