Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2332
  • Last Modified:

How to fire onClick client event of a hidden button from the code?

Hi,

I need in window.onload function to fire onClick event of the hidden button.
How to do this?
0
netformx
Asked:
netformx
  • 2
1 Solution
 
BatalfCommented:
<body onload="document.getElementById('myButton').onclick()">


<input id="myButton" type="button" style="visibility:hidden" onclick="alert('Hello')">
0
 
ZvonkoSystems architectCommented:
Or more generic:
<body onLoad="document.forms[0].myBtn.click()">
<form>
<input type=submit name="myBtn" style="display:none">
</form>
</body>

0
 
ZvonkoSystems architectCommented:
Uhps, sorry. My example initiates an infinite loop. Be warned :)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now