Tuesday, March 19, 2013

jQuery click() function.

jQuery click()
Simple Hello World display on mouse click.

When "Show message" link is clicked it calls jQuery click() function.

Example of jQuery click() function

<html>
<head>
<title>jQuery</title>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

<script type="text/javascript">
 
    $(document).ready(function()
    {
        $("#J_action_showMessage").click( function()
        {
            $("#mymsg").html("Hello World");
        });        
    });
 
</script>

</head>

<body> 
    
    <a id="J_action_showMessage" href="javascript:void(0)" >Show message</a>

    <div id="mymsg">

    </div>

</body>
</html>

Official documentation of jQuery click() function here.

No comments: