Dustin Cram wrote:
> Hi,
>
> I've run into the same problem of needing to bind events to elements
> loaded remotely. Rather than doing this manually in the OnOpen I've
> modified jqModal a bit so that jqm() supports a third, onLoad()
> callback so I can do:
>
>
> ****************
> $('#loginBox').jqm(
> {ajax: some_url, trigger: 'trigger'},
> false,
> false,
> function(h) { $("#my_button", h.w).bind("click", my_handler); }
> );
> ****************
>
> Is this something that could be added to jqModal?
>
> If anyone is interested the patched jqModal can be grabbed at
> http://gigs.cx/jqModal.js
>
Dustin,
Nice addition. I am considering adding something like this to the
base.. but there do exist two alternative methods -- a) using a $.load()
with a callback in the onOpen function && b) including script in the
remote response -- e.g. using the example above, include;
<script type="text/javascript">
$('#my_button').bind("click", my_handler);
</script>
in some_url.
Keep in mind that jqModal strives to stay on a diet.. do you still see
the onLoad callback as an essential?
~ Brice
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/