Solved

Html/Form events vs JQuery events

Posted on 2012-03-11
3
480 Views
Last Modified: 2012-03-12
Hi Everyone,
This might have been asked before, but I can't find a good explanation anywhere.  Which technique would be better to use; attaching an event handler to an element of a html form, such as onBlur="Handler" with its own Javascript function, or applying the handler in the $(document).ready section of  the initial Javascript section?  I'd eventually like to have it interface with php on the server side, so I know I'll have to do some Ajax on it.  Both methods look like they would give pretty much the same result, but I've seen articles online and in books that use one or the other.
Thanks
0
Comment
Question by:William-B
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 13

Accepted Solution

by:
Hugh McCurdy earned 500 total points
ID: 37708243
One method is not clearly better than the other.  They both end up using JavaScript (as I expect you already know).

I think the main distinction then is program maintainability.  You should choose the approach that is easier to follow.

IMHO, I think that means JQuery because I can automatically tell the maintenance engineer which areas of the page use JavaScript because I would (normally) identify areas by id and a good editor could then find id='foo' or whatever.  So, I'd choose JQuery simply because it's more obvious.
0
 

Author Comment

by:William-B
ID: 37708389
Thanks for your response.  Looking at it now I can definitely see how JQuery could make things a lot more manageable and clear for anyone else working on it.  Thanks again for your input.
0
 
LVL 13

Expert Comment

by:Hugh McCurdy
ID: 37709326
Thanks for the points.  Program maintainability is a very important issue.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question