Showing posts with label Adding visibility attribute. Show all posts
Showing posts with label Adding visibility attribute. Show all posts

Thursday, March 10, 2022

Adding visibility attribute

 There are two ways to add the visibility attribute for an element. They have a difference in the way it renedered in the HTML as shown below.


  1. $("#elementid").attr("style", "visibility: hidden")

  This will be rendered as 

style="visibility: hidden;"

 2. $("#elementid").css("visibility", "hidden")

  This will be rendered as 

style="width: 50px; color: red; visibility: hidden;"

 

 

In summary the first one will set the style attribute and the second one will append to the existing style attribute.


Cheers

Samihta