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?
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.
thank you. And as for onClick="addDetails(1,3), is there any reason why I should avoid using onClick?
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.
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.
sorry disturbing you mr., i have a problem with link…
this is parts of the script…