Hide and seek with DOM [PrefMatters]

Where to use hide(),show() & addClass,removeClass?
– Content is dynamic use hide(),show()
– Content is static use addClass, removeClass

Which one is faster?
– addClass, removeClass is faster

JSPref – https://jsperf.com/jquery-hide-and-show-vs-addclass-and-removeclass

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s