JQuery Programmer Question:

What is the difference between $('div') and $('<div/>') in jQuery?

Tweet Share WhatsApp

Answer:

$('<div/>') : This creates a new div element. However this is not added to DOM tree unless you don't append it to any DOM element.

$('div') : This selects all the div element present on the page.

Read All 201 JQuery Programmer Questions
Previous QuestionNext Question
What are selectors in jQuery and how many types of selectors are there?How to disable jQuery animation?