[thelist] [Javascript] click() not working with Safari
Christian Heilmann
codepo8 at gmail.com
Fri Jun 24 04:34:41 CDT 2005
> Say Html code is:
> <button id="a_button" type="submit" onclick="a_func()">text</button>
>
> Doing:
> document.getElementById( "submit" ).click();
> will not work, whereas the click event works fine on a <input>
> element.
>
> Short answer:
> Safari 2.0 doesn't implement Javascript method click() on <button>
> elements.
What is the rationale of click()?
wouldn't a
document.getElementById( "submit" ).onclick=a_func;
executed onload be cleaner, more supported and easier?
or even a
<form onsubmit="return a_func();">
Then you don't need to add anything to the HTML at all.
--
Chris Heilmann
Blog: http://www.wait-till-i.com
Writing: http://icant.co.uk/
Binaries: http://www.onlinetools.org/
More information about the thelist
mailing list