- 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 9053 Articles for Front End Technology
304 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
428 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
170 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.
602 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
277 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);
2K+ Views
Calling a JavaScript library function is quite easy. You need to use the script tag. As almost everything we do when using jQuery reads or manipulates the document object model (DOM), we need to make sure that we start adding events etc. as soon as the DOM is ready.If you want an event to work on your page, you should call it inside the $(document).ready() function. Everything inside it will load as soon as the DOM is loaded and before the page contents are loaded.To do this, we register a ready event for the document as follows:$(document).ready(function() { // ... Read More
439 Views
Easily include jQuery library into your HTML code directly from Content Delivery Network (CDN). Google and Microsoft provide content delivery for the latest version.You can try to run the following code to learn how to use Google CDN for jQuery:ExampleLive Demo jQuery CDN $(document).ready(function(){ document.write("Tutorialspoint!"); }); Hello
1K+ Views
To run jQuery on your web pages, add the library file within a pair of tags. The location of the jQuery library file is added under the tags, which point to the location of the jQuery library file on the Web server. Here’s an example, The location of the jQuery file on the web server should be the same as what you added in the script tags. Even if you don’t want to go for the hassles in setting up jQuery, then go for CDN. With Google CDN, it will be an easier way to include jQuery without ... Read More
2K+ Views
jQuery is a JavaScript library, so it operates on top of JavaScript. It cannot exist on its own, so you can't use one over the other. You can use just JavaScript or JavaScript and jQuery. jQuery was introduced to make development with JavaScript easier. It will reduce the development time. Use it to add animation and even handling on your website. jQuery simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is easier to use compared to JavaScript and its other JavaScript libraries. You need to write fewer lines of code while using jQuery, ... Read More
To Continue Learning Please Login
Login with Google