hi, first I'd like to tell you that I'm not a js developer I just need a little help, hope it won't be too complicated to understand for me
I need to click by code on a button which has no 'ID', 'name' nor 'tag. It has only 'class' and 'tab index'.
After some googling I found that there is possible to use GetElementbyClassName (which should work on firefox) but I;ve not been able to make it work. Could anybody give me an example of code which can handle this task?
you might have to change the 0 in  depending on how many other elements have that class name, and which order they appear in on the page
if you want it to work on all browsers (for example, older IE) it would require a little more code. not much, but a little
could you give me a simple working example ?
Note: document.getElementsByClassName is not available in IE
<input type=button class="class1" onclick="clicked()">
Thank you for your example, it works great but I still have a small problem. Button I want to click on by this code is defined like this:
When I replace your button line with this line , it keeps firing all the time (I know there is no event there but that has the same result e.g. alert window keeps opening.) Why is that? It does not make sense why this ends in some infinite loop.
to be more precise button is defined like this:
<button tabindex="2" class="button class" type="submit">OK</button>
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)