
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 8591 Articles for Front End Technology

1K+ Views
To handle a double click event using jQuery, use the dblclick() event. When an element is double clicked, this event occurs.ExampleYou can try to run the following code to learn how to handle double click event using jQuery −Live Demo $(document).ready(function(){ $("p").dblclick(function(){ alert("You have clicked this twice."); }); }); Double click

5K+ Views
To handle a click event using jQuery, use the click() method. You can try to run the following code to handle a link click event using jQuery −ExampleLive Demo $(document).ready(function(){ $("a").click(function(){ alert("You've clicked the link."); }); }); Click below link. Click
How can I remove everything inside of a using jQuery?
Updated on 14-Feb-2020 10:16:23
653 Views
To remove everything inside a div element, use the remove() method. You can try to run the following code to remove everything inside a element −ExampleLive Demo
$(document).ready(function(){
$(".btn").click(function(){
$("div#demo").remove();
});
});
Hide the elements inside div
Inside div- This is demo text.
Inside div- This is demo text.
Inside span- This is demo text.
Inside span- This is demo text.

653 Views
To remove everything inside a div element, use the remove() method. You can try to run the following code to remove everything inside a element −ExampleLive Demo $(document).ready(function(){ $(".btn").click(function(){ $("div#demo").remove(); }); }); Hide the elements inside div Inside div- This is demo text. Inside div- This is demo text. Inside span- This is demo text. Inside span- This is demo text.

2K+ Views
To remove all elements except the first one, use the remove() method with the slice() method in jQuery. You can try to run the following code to remove all elements except for first one using jQuery −ExampleLive Demo $(document).ready(function(){ $(".button1").click(function(){ $("span").remove(); }); $(".button2").click(function(){ $('span').slice(1).remove(); }); }); Hide all, except first element Hide all the elements This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text.

5K+ Views
To remove all child nodes from a parent, use the empty() method. The empty() method removes all child nodes from the set of matched elements.ExampleYou can try to run the following code to learn how to remove all child nodes from a parent −Live Demo jQuery empty() method $(document).ready(function() { $("div").click(function () { $(this).empty(); }); }); .div { margin:10px; padding:12px; border:2px solid #666; width:60px; } Click on any square below to see the result: ONE TWO

180 Views
The insertAfter( selector ) method inserts all of the matched elements after another, specified, set of elements.Here is the description of all the parameters used by this method −selector − Content after which the selected element(s) is inserted.ExampleYou can try to run the following code to learn how to use jQuery.insertAfter() method in jQuery −Live Demo jQuery insertAfter() method $(document).ready(function() { $("div").click(function () { $("#source").insertAfter(this); }); }); .div { margin:10px; padding:12px; border:2px solid #666; width:60px; } Click on any square below to see the result:

299 Views
The insertBefore( selector ) method inserts all of the matched elements before another, specified, set of elements. Here is the description of all the parameters used by this method −selector − Content before which the selected element(s) is inserted.ExampleYou can try to run the following code to learn how to use jQuery.insertBefore() method in jQuery −Live Demo jQuery insertBefore() method $(document).ready(function() { $("div").click(function () { $("#source").insertBefore(this); }); }); .div { margin:10px; padding:12px; border:2px solid #666; width:60px; } Click on any square below to see the result:

141 Views
The text( ) method gets the combined text contents of all matched elements. This method works for both on XML and XHTML documents.ExampleYou can try to run the following code to learn how to use jQuery.text() method in jQuery −Live Demo jQuery text() method $(document).ready(function() { var content = $("p#pid1").text(); $("#pid2").html(content); }); .red { color:red; } .green { color:green; } This is first paragraph. This is second paragraph.

153 Views
The wrapAll() method wraps all the elements in the matched set into a single wrapper element.Here is the description of all the parameters used by this method −elem − A DOM element that will be wrapped around the target.ExampleYou can try to run the following code to learn how to use jQuery.wrapAll() method in jQuery −Live Demo jQuery wrapAll() method $(document).ready(function() { $('ul.myclass > li:lt(2)').wrapAll('') }); .demo { border: 3px dashed blue; margin: 5px; } India US UK Australia Bangladesh

124 Views
The wrapInner() method wraps the inner child contents of each matched element (including text nodes) with a DOM element.Here is the description of all the parameters used by this method −html − A DOM element that will be wrapped around the target.ExampleYou can try to run the following code to learn how to use jQuery.wrapInner() method in jQuery −Live Demo jQuery wrapInner() method $(document).ready(function() { $("div").click(function () { ... Read More