whispering_Jack
whispering_Jack

Reputation: 557

jquery effect works in jfiddle but not online - help please

Still trying to solve this after many hours. The script works in jfiddle: http://jsfiddle.net/uCcYw/3/ ,apply flash effect to parent of add_item (simplecart_shelfitem), but not online: http://www.diysoakwells.com.au/test.html. Its the same code copied and pasted, i dont get it !! PLease help : )

Upvotes: 1

Views: 245

Answers (4)

Shyju
Shyju

Reputation: 218732

Change

(function() {
    $(".item_add").click(function() {
        $(this).parent().effect("highlight", {}, 750);

        return false;
    });
})(jQuery);

to

$(function() {
    $(".item_add").click(function() {     
        $(this).parent().effect("highlight", {}, 750);       
        return false;
    });
})

Working sample : http://jsfiddle.net/gtT4H/7/

Upvotes: 1

Rory McCrossan
Rory McCrossan

Reputation: 337560

Your ready handler is missing the $ from the start:

$(function() {
    $(".item_add").click(function() {
        $(this).parent().effect("highlight", {}, 750);

        return false;
    });
});

Upvotes: 0

Ed .
Ed .

Reputation: 6403

You haven't wrapped your JavaScript in a $(document).ready() call. The element with the specified class doesn't exist at the point of JS execution.

Upvotes: 0

Rami Alshareef
Rami Alshareef

Reputation: 7140

You need to put it inside

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

Upvotes: 5

Related Questions