maztt
maztt

Reputation: 12294

jquery applying css tag

$($("#myDiv")).append("<b>Hello</b>");

how can i apply to mydiv display:none

Upvotes: 0

Views: 147

Answers (2)

cletus
cletus

Reputation: 625007

Don't manipulate the display CSS property with css(). Use hide():

$("#myDiv").hide().append("Hello");

Why are you doing:

$($("#myDiv"))...

?

Upvotes: 4

Chris Meek
Chris Meek

Reputation: 5839

$("#myDiv").css("display","none"); should do the trick but look into the jquery hide method too (hide) which can hide the div "smoothly" if you want that.

Upvotes: 2

Related Questions