Alex Onsman has Published 203 Articles

What are the methods in jQuery to manipulate attributes?

Alex Onsman

Alex Onsman

Updated on 13-Jun-2020 06:41:35

79 Views

jQuery comes with a lot of methods to manipulate attributes. These are DOM related methods. The attributes include, text() – This method sets or returns the text content of elements selected.html() – This method sets or returns the content of elements selected.val() – This method sets or returns the value ... Read More

How to link jQuery from my local machine?

Alex Onsman

Alex Onsman

Updated on 12-Jun-2020 07:13:39

3K+ Views

You can add jQuery using CDN or through downloading it on local machine. For Local Installation, download jQuery library on your local machine and include it in your HTML code. The following are the steps:Go to the jQuery website to download the latest version available.Now put downloaded jquery-3.2.1.min.js file in ... Read More

What is the difference between height and line-height?

Alex Onsman

Alex Onsman

Updated on 08-May-2020 11:06:32

2K+ Views

Height is the vertical measurement of the container, for example, height of a div.Line-height is a CSS property to specify the line height i.e. the distance from the top of the first line of text to the top of the second. It is the space between the lines of two ... Read More

How to handle when checkbox 'checked state' changed event in jQuery?

Alex Onsman

Alex Onsman

Updated on 14-Feb-2020 12:48:52

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 ... Read More

Can I wrap a JavaScript event in a jQuery event?

Alex Onsman

Alex Onsman

Updated on 14-Feb-2020 12:47:50

184 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();   ... Read More

How to disable copy content function using jQuery?

Alex Onsman

Alex Onsman

Updated on 14-Feb-2020 12:46:49

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();   }); }); ... Read More

How does jQuery event namespace works?

Alex Onsman

Alex Onsman

Updated on 14-Feb-2020 12:44:34

167 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); ... Read More

What is the jQuery Event for user pressing enter in a textbox?

Alex Onsman

Alex Onsman

Updated on 14-Feb-2020 12:43:26

694 Views

The jQuery event for user pressing enter is keyup and keyCode. You can try to run the following code to trigger an event on pressing enter key in textbox, ExampleLive Demo $(document).ready(function(){    $('input').bind("enterKey", function(e){      alert("Enter key pressed");    });    $('input').keyup(function(e){      if(e.keyCode ... Read More

What are jQuery Event Helper Methods?

Alex Onsman

Alex Onsman

Updated on 14-Feb-2020 12:42:28

337 Views

jQuery also provides a set of event helper method which can be used either to trigger an event to bind any event types mentioned above.Trigger MethodsThe following is an example which would triggers the blur event on all paragraphs −$("p").blur();Binding MethodsThe following is an example which would bind a click ... Read More

What is the sequence of jQuery events triggered?

Alex Onsman

Alex Onsman

Updated on 14-Feb-2020 12:40:26

728 Views

The jQuery event handlers always execute in the order they were bound. With jQuery, you can also change the sequence. Let’s see how, for example, fromdemo(1); demo(2);We can change the sequence to −demo(2); demo(1);ExampleYou can try to run the following to learn and change the sequence of jQuery events −Live ... Read More

Advertisements