?
Solved

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

Posted on 2005-03-31
3
Medium Priority
?
2,322 Views
Last Modified: 2008-03-10
Hi,

I need in window.onload function to fire onClick event of the hidden button.
How to do this?
0
Comment
Question by:netformx
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 32

Accepted Solution

by:
Batalf earned 2000 total points
ID: 13669866
<body onload="document.getElementById('myButton').onclick()">


<input id="myButton" type="button" style="visibility:hidden" onclick="alert('Hello')">
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 13669925
Or more generic:
<body onLoad="document.forms[0].myBtn.click()">
<form>
<input type=submit name="myBtn" style="display:none">
</form>
</body>

0
 
LVL 63

Expert Comment

by:Zvonko
ID: 13669950
Uhps, sorry. My example initiates an infinite loop. Be warned :)
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question