Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
  1. #16
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,983
    Thanks
    56
    Thanked 557 Times in 554 Posts
    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.

  2. #17
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,401
    Thanks
    11
    Thanked 595 Times in 575 Posts
    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 13/9/26)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.6, IE11:9.1, IE9:3.1, IE10:3.0, FF:17.2, CH:46, SF:11.4, NON-MOUSE:38%

  3. #18
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,983
    Thanks
    56
    Thanked 557 Times in 554 Posts
    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...

  4. #19
    Senior Coder
    Join Date
    Apr 2011
    Location
    London, England
    Posts
    2,120
    Thanks
    15
    Thanked 354 Times in 353 Posts
    @rnd me
    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

  5. #20
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,401
    Thanks
    11
    Thanked 595 Times in 575 Posts
    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 13/9/26)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.6, IE11:9.1, IE9:3.1, IE10:3.0, FF:17.2, CH:46, SF:11.4, NON-MOUSE:38%


 
Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •