How to load jquery dialog in wordpress using wp_enqueue_script?

how can i load jquery dialog after page load? I mean, I don't want to load it every time I refresh the page.

I know it has to do with cookies.

here is my dialogue

var $j = jQuery.noConflict();

$j(function(){

    $j(document).ready(function(){

      $j('#west').dialog({show: 'slow', modal: true, height: 600, width: 850, title: 'Price Comparison Popup', resizable: false, draggable: false});        
      });        

    });

      

0


source to share


1 answer


I'm not sure I fully understand your questions, but if you just want to add a jquery-ui script to your code, use something like:

//assuming you are working on a plugin
$plugin_url = plugins_url('myPlugin');
//register and enqueue the script
wp_register_script("jquery-dialog", $plugin_url . '/js/jquery.dialog.js', 'jquery');
wp_enqueue_style('jquery-dialog');

      



This will include the script and make sure it is loaded after the jQuery version in Wordpress.

+1


source







All Articles