
Untitled
By: a guest on
May 25th, 2012 | syntax:
None | size: 0.92 KB | hits: 10 | expires: Never
Jquery modifying the click function of a button .
$("button").click() instead of standard $("button").click(function(){
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js" >
</script>
<script type="text/javascript">
$(document).ready(function(){
$("button").click()
{
callMe();
}
});
function callMe()
{
$("p").hide();
}
</script>
</head>
<body>
<h2>This is a heading</h2>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<button>Click me</button>
</body>
</html>
$("button").click()
{
callMe();
}
$("button").click(function()
{
callMe();
});
var myFunction = function()
{
callMe();
};
$("button").click(myFunction);
function myFunction()
{
callMe();
}
$("button").click(myFunction);
function callMe()
{
$("p").hide();
}
$(function(){
$("button").click(callMe)// just provide the reference to call me
});