elbatron
elbatron

Reputation: 705

Set Highslide attribute with jQuery

This is working when using images:

$("#div).attr('onClick', 'return hs.expand(this)');

This is not when using ajaxed content:

$("#div").attr('onClick', 'return hs.htmlExpand(this, { objectType: 'ajax'} )');

Probably there is something wrong with the syntax.

Upvotes: 0

Views: 582

Answers (2)

AlexBay
AlexBay

Reputation: 1313

Use live() instead of .attr()

$("#div").live('click', function () {
    return hs.htmlExpand(this, { objectType: 'ajax'});
});

Upvotes: 0

Rolando Cruz
Rolando Cruz

Reputation: 2784

If the word 'ajax' is really supposed to be embedded in the string then I guess you need double quotes:

$("#div").attr('onClick', 'return hs.htmlExpand(this, { objectType: "ajax"} )');

Upvotes: 1

Related Questions