Button click on jquery

Posted on 2011-10-20
Last Modified: 2012-05-12
I have a button, onload of the body, need to click the button on jquery function. I found that click() is trigerred on clicking the button manually. is there any way to click the button through jquery function.
Question by:gaurih
    LVL 81

    Accepted Solution

    $("#button1").click(function() { // wait a click from the use
           // to excute the code

    I think you're looking for :

    LVL 17

    Expert Comment

    Look at below example how button click event is fired when your change the text in textbox.
    Here is demo :

    <meta http-equiv="Content-Language" content="en-gb">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Kiran Test</title>
    <script src="" type="text/javascript"></script>
       alert("button is click event fired");
    <input type="button" id="btn" value="button click">
    <input type="text" id="txt">

    Open in new window


    Author Closing Comment

    Thanks for your quick response.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Introduction HyperText Transfer Protocol ( or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    The viewer will learn how to dynamically set the form action using jQuery.
    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…

    754 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

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now