- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 8895 Articles for Front End Technology
![Alex Onsman](https://www.tutorialspoint.com/assets/profiles/13357/profile/60_91536-1512482971.jpg)
631 Views
To bind jQuery events within dynamic content, use event delegation. You can try to run the following code to learn how to bind jQuery events within dynamic content returned via Ajax:Live Demo $(document).ready(function(){ $(".loadingAjax").on("click", function() { event.preventDefault(); var url = $(this).attr("href"), appendedContainer = $(".append"); $.ajax({ url: url, type : 'get', complete : function( qXHR, textStatus ) { if (textStatus === 'success') { var data = qXHR.responseText appendedContainer.hide(); appendedContainer.append("Hi"); appendedContainer.fadeIn(); } } }); }); $(document).on("click", '.link', function(event) { alert("Link clicked!"); }); }); a.test { font-weight: bold; } body { font-family: sans-serif;} Click to load Ajax
![Alex Onsman](https://www.tutorialspoint.com/assets/profiles/13357/profile/60_91536-1512482971.jpg)
2K+ Views
To handle the checkbox checked state, use the change event. It will check whether the checkox is checked or not.ExampleYou can try to run the following code to learn how to handle when checkbox checked state changed event in jQuery −Live Demo jQuery Checkbox state b { color: red; } Check/ Uncheck this checkbox $( "input" ).change(function() { var $input = $( this ); $( "p" ).html( ".attr( \"checked\" ): " + $input.attr( "checked" ) + "" + ".prop( \"checked\" ): " + $input.prop( "checked" ) + "" + ".is( \":checked\" ): " + $input.is( ":checked" ) + "" ); }).change();
![Alex Onsman](https://www.tutorialspoint.com/assets/profiles/13357/profile/60_91536-1512482971.jpg)
197 Views
Yes, you can wrap a JavaScript event in a jQuery event. For wrapping, use the event object. You can try to run the following code to wrap a JavaScript event in a jQuery event −ExampleLive Demo $(document).ready(function(){ $('a.one').click(function(event){ event.preventDefault(); }); function test(event){ $.Event(event).preventDefault(); } }); a.test { font-weight: bold; } body { font-family:sans-serif; } Tutorials QA
![Alex Onsman](https://www.tutorialspoint.com/assets/profiles/13357/profile/60_91536-1512482971.jpg)
2K+ Views
To disable cut, copy and paste of a content in jQuery, use the jQuery bind() function.ExampleYou can try to run the following code to disable copy paste of content using jQuery −Live Demo $(document).ready(function(){ $('#mytext').bind("cut copy paste",function(e) { e.preventDefault(); }); }); Copy, cut and paste function doesn't work here.
![Alex Onsman](https://www.tutorialspoint.com/assets/profiles/13357/profile/60_91536-1512482971.jpg)
3K+ Views
To disable right click on a page, use the jQuery bind() method.ExampleYou can try to run the following code to learn how to disable right click:Live Demo $(document).ready(function(){ $(document).bind("contextmenu",function(e){ return false; }); }); Right click is disabled on this page.
![Alex Onsman](https://www.tutorialspoint.com/assets/profiles/13357/profile/60_91536-1512482971.jpg)
3K+ Views
To pass a jQuery event as a parameter in a method, use the bind() method.ExampleYou can try to run the following code to learn how to apss a jQuery event as a parameter:Live Demo $(document).ready(function(){ $("#btn1").bind("click", { key1: "value1", key2: "value2" }, myFunction); function myFunction (event) { $("#myid").text(event.data.key1); } });
![Alex Onsman](https://www.tutorialspoint.com/assets/profiles/13357/profile/60_91536-1512482971.jpg)
13K+ Views
To work with jQuery Datepicker onchange(), use the datepicker onSelect event. This will show which date we added currently and changed to.ExampleYou can try to run the following code to learn how to work jQuery Datepicker onchange:Live Demo $( function() { $(".date").datepicker({ onSelect: function(dateText) { display("Selected date: " + dateText + ", Current Selected Value= " + this.value); $(this).change(); } }).on("change", function() { display("Change event"); }); function display(msg) { $("").html(msg).appendTo(document.body); } }); Date:
![Alex Onsman](https://www.tutorialspoint.com/assets/profiles/13357/profile/60_91536-1512482971.jpg)
204 Views
Events are actions that can be detected by your Web Application. When these events are triggered you can then use a custom function to do pretty much whatever you want with the event. These custom functions call Event Handlers.ExampleLet us see an example of bind() jQuery event. Using the jQuery Event Model, we can establish event handlers on DOM elements with the bind() method as follows:Live Demo jQuery bind() $(document).ready(function() { $('div').bind('click', ... Read More
![Alex Onsman](https://www.tutorialspoint.com/assets/profiles/13357/profile/60_91536-1512482971.jpg)
332 Views
To handle HTML5 media events using jQuery, use the click() method.ExampleYou can try to run the following code to learn how to handle HTML5 media events such as playing a song:Live Demo $(document).ready(function(){ var x = $(".myPlayer").length; // Count total audio players var z = 0; // Start at first audio player $("#play-bt").click(function(){ $(".myPlayer")[z].play(); $(".message").text("Music started"); }) $("#stop-bt").click(function(){ $(".myPlayer")[z].pause(); $(".myPlayer")[z].currentTime = 0; $(".message").text("Music Stopped"); }) }); Play music Stop music
![Alex Onsman](https://www.tutorialspoint.com/assets/profiles/13357/profile/60_91536-1512482971.jpg)
168 Views
The event.namespace property is used to return the custom namespace when the event was triggered.ExampleYou can try to run the following code to learn how event namespace works and how to create and remove namespace −Live Demo $(document).ready(function(){ $("p").on("custom.myNamespace",function(event){ alert(event.namespace); }); $("p").click(function(event){ $(this).trigger("custom.myNamespace"); }); $("button").click(function(){ $("p").off("custom.myNamespace"); }); }); Click me Click above to generate an alert box. Click the below button to remove namespace, which won’t generate an alert box. Click this button to remove namespace.