Amit D

Amit D

58 Articles Published

Articles by Amit D

58 articles

How to load external website into an <iframe> using jQuery?

Amit D
Amit D
Updated on 04-Apr-2023 39 Views

To load an external HTML into using jQuery, use the attr() method. In that set the source for iframe. You can try to run the following code to learn how to locate external HTML −ExampleLive Demo $(document).ready(function(){    $('#iframe').attr('src', 'https://www.qries.com'); });

Read More

What are jQuery events .load(), .ready(), .unload()?

Amit D
Amit D
Updated on 15-Jun-2020 1K+ Views

jQuery load() methodThe load() method is used to attach event handler to load event.ExampleYou can try to run the following code to learn how to work with jQuery load() method.Note:  The method deprecated in jQuery 1.8. It got finally removed in jQuery 3.0. To run the following code, add jQuery version lesser than 1.8, Live Demo $(document).ready(function(){     $("img").load(function(){         alert("This is an image.");     }); }); This image will load only in jQuery version lesser than 1.8 jQuery ready() methodEasily specify what ...

Read More

How to use wildcards like $ (&#039;#name*&#039;), $ (&#039;#name%&#039;) in jQuery selectors?

Amit D
Amit D
Updated on 13-Jun-2020 5K+ Views

For getting the id that begins or ends with a particular string in jQuery selectors, you shouldn’t use the wildcards $('#name*'), $('#name%'). Instead use the characters ^and $. The ^ is used is used to get all elements starting with a particular string. The $ is used is used to get all elements ending with a particular string.ExampleYou can try to run the following code to learn how to get id beginning and endingwith a particular string.Live Demo $(document).ready(function(){   $("[id$=new1]").css("background-color", "yellow");   $("[id^=myid]").css("background-color", "green"); }); Java HTML Ruby C++

Read More

How to use multiple versions of jQuery on the same page?

Amit D
Amit D
Updated on 12-Jun-2020 5K+ Views

Yes, you can use multiple versions of jQuery on the same page. To avoid any kind of conflict, use the jQuery.noConflict() method. jQuery.noConflict() method allows you to use multiple frameworks, while using jQuery. Other JavaScript frameworks include Ember, Angular, Backbone, etc.The $ sign is used for jQuery, but what if other frameworks also use the same $ sign; this may create issues and conflict. To avoid this, jQuery issued the noConflict() method. The method releases the $ sign to be used my other JavaScript frameworks. Use jQuery with the name, jQuery.With this, you can also use multiple versions of jQuery ...

Read More

How to call a function inside a jQuery plugin from outside?

Amit D
Amit D
Updated on 12-Jun-2020 977 Views

To call a function inside a jQuery plugin from outside, try to run the following code. The code updates the name with jQuery as an example using properties:Live Demo                          $.fn.person = function(prop) {             var defaults = $.extend({                name: 'Amit'             }, prop);                 // methods to be used outside of the plugin             var person = ...

Read More

How to load a page in div using jQuery?

Amit D
Amit D
Updated on 17-Feb-2020 2K+ Views

To load a page in div in jQuery, use the load() method. Firstly, add the web page you want to add.Here’s the code for new.html −     This is demo text. ExampleNow, the code snippet for the file which adds the above page, $(document).ready(function() {        $('#content').load("new.html"); });

Read More

How to disable a particular jQuery event on a page?

Amit D
Amit D
Updated on 17-Feb-2020 640 Views

To disable a particular jQuery event, use the jQuery off() method. You can try to run the following code to learn how to disable a particular jQuery event on a page −ExampleLive Demo $(document).ready(function(){     $("p").on("click", function(){         alert("You clicked it!");     });     $("button").click(function(){         $("p").off("click");     }); }); Click me Click above to generate an alert box. Click the below button to remove namespace, which won’t generate an alert box. Remove Event

Read More

How to make text bold, italic and underline using jQuery

Amit D
Amit D
Updated on 17-Feb-2020 4K+ Views

To make text bold, italic and underline using jQuery, use the jQuery css() method with the CSS properties font-style, font-weight and text-decoration. You can try to run the following code to learn how to make text bold, italic and underline using jQuery −ExampleLive Demo $(document).ready(function(){     $("p").on({         mouseenter: function(){         $(this).css({"font-style": "italic", "font-weight": "bold","text-decoration": "underline"});         }     });     }); Move the mouse pointer on the text to make text bold, italic and underline.

Read More

How can I change the font family and font size with jQuery?

Amit D
Amit D
Updated on 17-Feb-2020 2K+ Views

To change the font family and font size with jQuery, use the jQuery css() method. The css property font-family and font-size is used. You can try to run the following code to learn how to change font family and font size with jQuery −ExampleLive Demo $(document).ready(function() {    $("p").on({      mouseenter: function() {         $(this).css({"font-family": "Arial, Helvetica, sans-serif", "font-size": "200%"});      }    });     }); Move the mouse pointer on the text to change the font family and size.

Read More

How can I change the text color with jQuery?

Amit D
Amit D
Updated on 17-Feb-2020 13K+ Views

To change the text color with jQuery, use the jQuery css() method. The color css property is used to change text color.ExampleYou can try to run the following code to learn how to change text color with jQuery −Live Demo $(document).ready(function(){     $("p").on({         mouseenter: function(){             $(this).css("color", "red");         }     });     }); Move the mouse pointer on the text to change the text color.

Read More
Showing 1–10 of 58 articles
« Prev 1 2 3 4 5 6 Next »
Advertisements