newbie85 — 2011-03-14T10:12:19-04:00 — #1
The page has add details link. When user clicks it, it shows ajax pop up.
The above example done also with defining new fucntion and using onClick. Would be this still be considered as a proper way? Why some people are saying that I should not use onClick?
And if this is not a proper (best practice) way. What if user need to pass also some arguments, like the following?
felgall — 2011-03-14T14:31:20-04:00 — #2
raffles — 2011-03-14T14:35:25-04:00 — #3
Even if must only definitely work with JS on, it's better to use a link because then the user can tab to it with the keyboard. If it's not a link, then it's impossible to "click" it without a mouse.
newbie85 — 2011-03-14T15:34:00-04:00 — #4
thank you. And as for onClick="addDetails(1,3), is there any reason why I should avoid using onClick?
felgall — 2011-03-14T17:05:31-04:00 — #5
raffles — 2011-03-15T15:03:57-04:00 — #6
ruben_k — 2011-03-16T03:57:57-04:00 — #7
felgall — 2011-03-16T04:42:01-04:00 — #8
That is the least of the jmany problems that code causes - so trivial in comparison to all the other issues since most people who would receive such an alert would have plenty of other reasons for abandoning that web site regardless of what browser they are using.
stomme_poes — 2011-03-16T04:48:54-04:00 — #9
If it's not a link, then it's impossible to "click" it without a mouse.
Well, but if for whatever reason it needs to be some other element, there is always JS adding a negative tab index so it can add focus() itself for mouseless.
Personally I do the Let-JS-Create-The-Object because nothing's more frustrating as a user than having crap on a page that doens't work. Don't make promises to your users that you can't always keep. A link is a "promise" in usability.
wasis — 2012-02-13T03:43:20-05:00 — #10
sorry disturbing you mr., i have a problem with link..
this is parts of the script..