How to Get jqModal and jQuery 1.4 Play Nice – Part II

In Part I, I showed how to get jqModal and jQuery 1.4.x to play nice together.  That was huge for me.  Then I wanted to use jqModal in WordPress.  It wasn’t working.  Drove me nuts.  Yet the way to resolve it was simple… of course if you’re a javascript ninja, you’re probably laughing at me.  But this post isn’t for javascript ninjas… it’s for others, like me.

I’ll assume you know how to enqueue your javascript into WordPress.  You can also read more about doing it “the right way.”  I’m going to show the quick little thing that made my morning the other day.

I was trying to get the jqModal working.  This is the code I had:

$().ready(function() {
$('#dialog').jqm();
});

It wasn’t working… then reading the “the right way” to do it and a flash of inspiration, I now have this:

var $j = jQuery.noConflict();
$j(document).ready(function() {
$j('#dialog').jqm();
});

Of course, you can replace $j with whatever you want.  This works with the jqModal fix shown in Part I.

Now, jQuery and jqModal play nice in my WordPress. It’s been a good morning. Funny how such little, simple things make life good.

Tagged with: , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Confirm that you are not a bot - select a man with raised hand: