Posted by: Sukhon | June 6, 2010

JQuery $(document).ready is not working in wordpress

jQuery code conflicts with other variable code. the $() syntax is always used by other scripting library, and causing the conflict issue and fail to call the jQuery function. Never use jQuery handy function $() in Wordpress plugin. You have to use jQuery() or jQuery.noConflict()

Usual code:

$(document).ready(
function () {
$(‘#expandiv’).flash(
{
swf:  ’/fathersday.swf’,
width:680,
height:495,
wmode:’transparent’
});
});

The above will not work. We have to use the following

Solution:

$j=jQuery.noConflict();
$j(document).ready(
function () {
$j(‘#expandiv’).flash({

swf: site_skin_images + ‘/jackgeorges_fathersday.swf?i=443′,
width:680,
height:495,
wmode:’transparent’
});
});

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Categories

Follow

Get every new post delivered to your Inbox.