Looking for something like jquery's event.preventDefault function

547 views
Skip to first unread message

Mandla Mbuli

unread,
Dec 28, 2012, 1:11:58 AM12/28/12
to enf...@googlegroups.com
Hi

I am looking for a way to prevent a <input type="submit" value="Login"/> from submitting.
I know I can use <a>Login</a> or change the type of the input but I would prefer to use input 
with the type specified. 

In jquery I have used event.preventDefault and I noticed from ClojureScript up and Running that 
domina has this function (domina.events/prevent-default event) so I am hoping enfocus also has
it and I just have not been looking properly. 

faithfully 
Mandla

ckirkendall

unread,
Dec 28, 2012, 12:58:19 PM12/28/12
to enf...@googlegroups.com
Domina's just delegates to the goog.events obj.  Enfocus give you direct access to the event object.  I believe this will do what you want.


(em/at js/document
  ["id-of-button"] (em/listen :click #(do 
                                                   (.preventDefault %)
...)))


CK

Mandla Mbuli

unread,
Dec 29, 2012, 1:36:38 AM12/29/12
to enf...@googlegroups.com
Thank you very much Sir.

I also just noticed its in the documentation site: 
"The event object is of type goog.event.Event. Documentation for this object can be found here"

happily :-)
Mandla
Reply all
Reply to author
Forward
0 new messages