[Javascript] Which submit caused the event?

Mike Dougherty mdougherty at pbp.com
Wed Jan 2 12:39:32 CST 2013


On Wed, Jan 2, 2013 at 11:52 AM, Hassan Schroeder <hassan at webtuitive.com>wrote:

> On 1/1/13 7:48 PM, Mike Dougherty wrote:
>
>  Should this event registration even be done in markup?  If the script tag
>> with the document.onclick registration failed for some reason, this form
>> would be completely broken.
>>
>
> /*smacks head*/
>
> My earlier post was an utterly trivial throwaway page based on Tedd's
> example to demonstrate one single thing, event.target, and deliberately
> stuck close to his original markup for clarity.
>
> But you want to analyze an obviously contrived example "form" with three
> submits and NO DATA FIELDS for production-phase best practices? Really?
>
> In any case, if you thought that demonstration of event.target lacking,
> why not post your own improved version?
>
>
First let me apologize for the misunderstanding.  I was not suggesting
there was anything at all wrong with the proposed solution.  I prefaced
with "i understand overkill for a simple example"

I was thinking it would be a good disclaimer to say, "this shows the
concept, of course you'll register event listeners"  (something to that
effect)

There are a lot of old examples on the web.  I learned how to write
javascript from a lot of IE-specific examples that are still on the first
page of google results for whatever keywords came to mind when I had a
particular problem to solve.  The benefit of an email list like this is
that we can converse/discuss to improve a solution.  In this case I brought
up best practice of "progressive enhancement" in case Tedd was not familiar
with the idea.

tbh, I was as much asking your opinion/advice as anything else.  You've
been posting to this longer than I've been a member; far be it from me to
judge anyone's contribution.


More information about the Javascript mailing list