Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-12-2013, 05:48 PM   PM User | #16
xelawho
Senior Coder

 
xelawho's Avatar
 
Join Date: Nov 2010
Posts: 2,437
Thanks: 52
Thanked 454 Times in 452 Posts
xelawho will become famous soon enoughxelawho will become famous soon enough
ha, ha. I figured it out finally, and of course it's obvious when you look at it and has nothing to do with what I thought it did.

Here's the thing: the form (or whatever it is) gets submitted via the click on the button. So adding another click listener puts that second listener at the end of the queue, and the function fires too late (I don't know how this fits in with LIFO, or maybe I just don't understand LIFO).

But of course using mousedown means you get to sneak in before the click function fires and do your validation routine.

Thanks for sticking with me, though, rnd me. It was an interesting discussion regardless.
xelawho is offline   Reply With Quote
Old 01-13-2013, 12:05 AM   PM User | #17
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,468
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
Well, I never give up, especially for fellow regulars. I've always found jQuery events incredibly complicated and confusing when it comes to working on them from the outside. With event attribs, you can see what's doing what, but jQuerys are invisible and hard to control. Especially when you have to adjust a fully-implemented site you didn't create, it can be a bear.

Earlier in my career, i had a related problem that drove me to the edge of sanity: Ihad to clone and hide a button in order to add the event up-front. Once the clone's click was complete, it dispatched a mousedown(), click(), and mouseup() to the orig but now-hidden button. A convoluted workaround for sure, but one that ultimately bought six more months until a site rebuild.

Anyways, glad it's resolved...
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.6% IE9:9.8% IE10:10%
rnd me is offline   Reply With Quote
Old 01-13-2013, 12:25 AM   PM User | #18
xelawho
Senior Coder

 
xelawho's Avatar
 
Join Date: Nov 2010
Posts: 2,437
Thanks: 52
Thanked 454 Times in 452 Posts
xelawho will become famous soon enoughxelawho will become famous soon enough
Quote:
Originally Posted by rnd me View Post
I've always found jQuery events incredibly complicated and confusing when it comes to working on them from the outside. With event attribs, you can see what's doing what, but jQuerys are invisible and hard to control.
ha! pretty much the topic of my other post - it works, I just don't know why. Which for some reason I find even more frustrating than the other way 'round...
xelawho is offline   Reply With Quote
Old 01-13-2013, 01:22 PM   PM User | #19
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
@rnd me
Quote:
With event attribs, you can see what's doing what, but jQuerys are invisible
? Don't we have the event attributes available..?

Code:
$("#target").click(function (e) {
  console.log(e);
});
Or perhaps this is a tweaked version of the event object?
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS
AndrewGSW is offline   Reply With Quote
Old 01-13-2013, 01:56 PM   PM User | #20
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,468
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
Quote:
Originally Posted by AndrewGSW View Post
@rnd me


? Don't we have the event attributes available..?

Code:
$("#target").click(function (e) {
  console.log(e);
});
Or perhaps this is a tweaked version of the event object?
you show an event argument, not an attribute.

it the difference between debugging this:
Code:
<input value=ok type=button />
and this:
Code:
<input value=ok type=button onclick="addSelectionToList()" />
based on the desire of "semantic documents" javascript was moved from binding ui inline to external files. While it might make librarians happy, the practice is frustrating to people who maintain web apps.
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.6% IE9:9.8% IE10:10%
rnd me is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:11 PM.


Advertisement
Log in to turn off these ads.