开发者

Set Highslide attribute with jQuery

开发者 https://www.devze.com 2023-04-04 09:51 出处:网络
This is working when using images: $(\"#div).attr(\'onClick\', \'return hs.expand(this)\'); This is 开发者_如何学Pythonnot when using ajaxed content:

This is working when using images:

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

This is 开发者_如何学Pythonnot when using ajaxed content:

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

Probably there is something wrong with the syntax.


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"} )');


Use live() instead of .attr()

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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号