JavaScript style display none or jQuery hide is more efficient

0 votes
document.getElementById("elementId").style.display="none"

is used in JavaScript to hide an element. But in jQuery,

$("#elementId").hide();

is used for the same purpose. Which way is more efficient? I have seen a comparison between two jQuery function .hide() and .css("display","none").

But my problem is whether pure JavaScript is more efficient than jQuery?

Jun 29, 2022 in Web Development by gaurav
• 23,260 points
3,850 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Talking about efficiency:

document.getElementById( 'elemtId' ).style.display = 'none';

What jQuery does with its .show() and .hide() methods is, that it remembers the last state of an element. That can come in handy sometimes, but since you asked about efficiency that doesn't matter here.

answered Jun 30, 2022 by rajatha
• 7,680 points

edited Mar 5

Related Questions In Web Development

0 votes
1 answer

What is the difference between JavaScript and jQuery?

JavaScript is an independent language and can ...READ MORE

answered Jun 27, 2022 in Web Development by rajatha
• 7,680 points
805 views
0 votes
1 answer

More efficient way to do parent().parent().parent() etc. in jquery

The jQuery parent() and parents() methods return the ...READ MORE

answered Jun 27, 2022 in Web Development by rajatha
• 7,680 points
499 views
0 votes
0 answers

How to filter JSON Data in JavaScript or jQuery?

How to filter JSON data using Javascript ...READ MORE

Jul 1, 2022 in Web Development by rajatha
• 7,680 points
2,578 views
0 votes
0 answers

jQuery & CSS - Remove/Add display:none

I have a div with this class ...READ MORE

Jul 20, 2022 in Web Development by gaurav
• 23,260 points
1,839 views
0 votes
0 answers

jQuery & CSS - Remove/Add display:none

I have a div with this class ...READ MORE

Jul 21, 2022 in Web Development by gaurav
• 23,260 points
764 views
0 votes
0 answers

JavaScript or jQuery "Are you sure?" dialog for <A> link?

I have a link in my HTML: <a ...READ MORE

Jul 26, 2022 in Web Development by gaurav
• 23,260 points
506 views
0 votes
1 answer

What is jQuery?

Hey, jQuery is a fast and concise JavaScript ...READ MORE

answered Feb 14, 2020 in JQuery by kartik
• 37,520 points
1,566 views
0 votes
1 answer

Uncaught TypeError: Cannot read property 'msie' of undefined - jQuery tools

Hello, Use the following script tag in your ...READ MORE

answered Apr 28, 2020 in JQuery by Niroj
• 82,840 points
16,590 views
0 votes
1 answer

Uncaught Error: Bootstrap's JavaScript requires jQuery

Hello @kartik, You have provided wrong order for ...READ MORE

answered Apr 28, 2020 in JQuery by Niroj
• 82,840 points
23,855 views
0 votes
1 answer

How to make Bootstrap popover Appear/Disappear on hover instead of click?

Hello @kartik, Set the trigger option of the popover to hover instead ...READ MORE

answered May 12, 2020 in JQuery by Niroj
• 82,840 points
3,574 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP