开发者

Using JQuery inside a boxy modal

I'm working on a site which has a modal window (using boxy) with a form. Inside document ready I have the following to load up the modal window:

$("#confirm").boxy({title: "Title", modal: true});

Where the link is:

<a id="confirm" href="开发者_JS百科/confirm/">Confirm order</a>

And this runs fine where /confirm/ loads up a new html in the modal window.

But in the modal window I want to do some JQuery manipulations. But even simple things don't work. For example:

$("#link").click(function () {
  console.log('logging...');
});

Where "link" is the id on a link in the modal window, but when I click the link nothing happens. If I comment out the top and bottom lines (only have the console.log line it DOES log to the console...)

Everything works fine if I run this in a separate window. Am I missing something obvious?

Regards, AndriJan


Please use live function at the same time, target the id of the "a href" youre using...

$("#confirm").live('click', function () {
  console.log('logging...');
});


I don't have much experience working with this plugin. But try adding your binding in the afterShow callback and see if it works. If it works, then there is an issue in the plugin that prevents from working your onload event

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜