jQuery select2 get selected value using jQuery.

jQuery select 2 is the most popular javascript framework for the select dropdown. jQuery select 2 provide beautiful functionality for searching value from the dropdown option. jQuery select 2 is the best solution for the dropdown because We can easily render more than thousand of data on the dropdown.

Continue reading jQuery select2 get selected value using jQuery.

jQuery chosen select value using jQuery

jQuery chosen is the best library for maintaining the HTML select dropdown. jQuery select box is developer friendly and user-friendly library. The developer can easily customize the design as he/she want. You can get more detail from here.

Let’s how we can change the chosen dropdown value using jQuery. Normally we can change the Dropdown value like.

Continue reading jQuery chosen select value using jQuery

jQuery get the event when bootstrap modal is open?

How to get the event when Bootstrap modal is open? Many times we need the event for changing some information on modal before modal display. So let’s see, How to get the jQuery event before modal is open.

First of all, we create the simple bootstrap modal.

Continue reading jQuery get the event when bootstrap modal is open?

AdminLte active current menu using JAVASCRIPT

AdminLte is the most popular and open source admin theme. many developers used AdminLte for developing admin panel. Many Developers use PHP if condition for active the current sidebar menu. It’s hard to manage with if condition when we have many sidebar menus.

I think we should use JAVASCRIPT for active the current menu for the sidebar. it’s too easy and simple js snippets.

$(document).ready(function(){

    var url = window.location;
    // Will only work if string in href matches with location
    $('ul.nav a[href="'+ url +'"]').parent().addClass('active');

    // Will also work for relative and absolute hrefs
    $('ul.nav a').filter(function() {
        return this.href == url;
    }).parent().addClass('active');
});

Just add above code into your javascript file. then checked the “active” class is add onto your current menu.

How to properly use jQuery noConflict mode in WordPress

How to properly use Jquery noConflict mode because many times we face jQuery Conflict error. so let’s see how to write noConflict jQuery on WordPress.

So when you write jQuery on WordPress write a syntax like below.

(function($){

  $(document).ready(function(){
      // write code here
  });

  // or also you can write jquery code like this

  jQuery(document).ready(function(){
      // write code here
  });

})(jQuery);

Then write your jQuery code without Conflict you can write with ‘$’ or ‘jQuery’. So create a jQuery without conflict.

If you face any problem after using this code write the comment.