- 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 10877 Articles for Web Development
3K+ Views
jQuery is a JavaScript library introduced to make development with JavaScript easier. Let us see how to use variable in a string using the html() method.ExampleYou can try to run the following code to learn how to use variable in a string in jQuery −Live Demo $(function(){ $("a").click(function(){ var id= $(".id").html(); $('.myclass').html("Hello"); }); }); Click me Learners
115 Views
jQuery.conflict() method allows you to use multiple frameworks, while using jQuery. 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.ExampleYou can try to run the following code to learn how to work with the noConflict() method −Live Demo $.noConflict(); jQuery(document).ready(function(){ jQuery("button").click(function(){ jQuery("h3").text("jQuery works perfectly"); }); }); ... Read More
158 Views
To create a jQuery plugin, first create a file named jquery-demoplugin.js with the following code. This is our plugin code. Here, demoplugin is the name of our plugin. You can add any name to your custom plugin −(function ( $ ) { $.fn.demoplugin = function( options ) { var web = $.extend({ name: 'example' }, options ); return this.append('Website: ' + web.name + '.com'); }; }( jQuery ));Now, to load it, add to the HTML file, new.html − $( document ).ready(function() { $( '#content ).demoplugin(); });
3K+ 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
303 Views
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.You can try to run the following code to learn how to use multiple JavaScript libraries along with jQuery − var $x = jQuery.noConflict(); // ... Read More
422 Views
To create a jQuery plugin, firstly create a file named jquery-myplugin.js with the following code. This is our plugin code. Here, myplugin is the name of our plugin.(function ( $ ) { $.fn.myplugin = function( options ) { var web = $.extend({ name: 'tutorialspoint' }, options ); return this.append('Website: ' + web.name + '.com'); }; }( jQuery ));Now, to load it, add to the HTML file, new.html: $(document).ready(function() { $('#myclass').myplugin(); }); Run the above code and you can see the text is visible, which shows your custom plugin is working correctly.
238 Views
WordPress is an open source CMS, used to develop dynamic websites. Let’s learn how to add jQuery script to WordPress. In the WordPress Theme folder, create a folder "js", and add a file in that. That file will be your Query file with extension “.js”. Add your jQuery script to that file. We have named it new.js, Here’s your jQuery script:jQuery(document).ready(function($) { $('#nav a').last().addClass('last'); });Open your theme's functions.php file. Use the wp_enqueue_script() function so that you can add your script. Here’s the code:add_action( 'wp_enqueue_scripts', 'add_my_script' ); function add_my_script() { // name your script to attach other scripts and de-register, ... Read More
169 Views
To call a jQuery plugin without specifying any elements, use extend method. Here’s a snippet showing how to call a jQuery plugin without specifying any elements:$.fn.extend({ myFunction1: function(){...} }); $.extend({ myFunction2: function(){...} });Above, you can see we’re calling myFunction1 and myFunction2 without specifying any elements and using jQuery extend.
587 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
273 Views
jQuery is a JavaScript library introduced to make development with JavaScript easier. It reduces the development time. Let us see how to call a jQuery plugin function outside the plugin.For calling, wrap the jQuery method for returning the instance of the constructor. Call prototype methods on it.example$.fn.myFunction = function(config){ return new myFunction (config); };Instance the plugin and call the method −var plugin = $('#someSelector').myFunction(); plugin.setToken(column);
To Continue Learning Please Login
Login with Google