> Can I force the click event to fire manually?
To trigger an event you can use...wait for it...trigger(). :-)
$("foo").trigger("click");
Or you can call click with no arguments:
$("foo").click();
As with a real click, the "this" will be pointing to the element. I'm not
sure about the detail
> I was wondering having done:
>
> $(".foo").click(function (e) {alert ("foo");});
>
> Can I force the click event to fire manually, or do I resort to
>
> var x = function (e) {alert ("foo");}
> $("#foo").click(x);
> ele = $("#foo").get(0)
> x.call( ele, {target:ele});
You can use either of the
Adam van den Hoven schrieb:
> I was wondering having done:
>
> $(".foo").click(function (e) {alert ("foo");});
>
> Can I force the click event to fire manually, or do I resort to
>
> var x = function (e) {alert ("foo");}
> $("#foo").click(x);
> ele = $("#foo").get(0)
> x.call( ele, {target:ele})
Adam van den Hoven wrote:
> Can I force the click event to fire manually, or do I resort to
>
I think you can do this with the "apply" call, although i am unsure how ;)
P.s. nice surname ;)
___
jQuery mailing list
discuss@jquery.com
http://jquery.com
I was wondering having done:
$(".foo").click(function (e) {alert ("foo");});
Can I force the click event to fire manually, or do I resort to
var x = function (e) {alert ("foo");}
$("#foo").click(x);
ele = $("#foo").get(0)
x.call( ele, {target:ele});
Adam
__