jQuery Event
1. ready
$(document).ready(function(){}) or $(function(){})
2. bind
$("p").bind("click", function(e){
var str = "( " + e.pageX + ", " + e.pageY + " )";
$("span").text("Click happened! " + str);
});
3. trigger
$("button:first").click(function () {
update($("span:first"));
});
$("button:last").click(function () {
$("button:first").trigger('click');
update($("span:last"));
});
4. toggle
$("li").toggle(
function () {
$(this).css({"list-style-type":"disc", "color":"blue"});
},
function () {
$(this).css({"list-style-type":"disc", "color":"red"});
},
function () {
$(this).css({"list-style-type":"", "color":""});
}
);
5. etc
click( fn )
dblclick( fn )
focus( fn )
keydown( fn )
mouseover( fn )
select( fn )
submit( fn )
$(function(){
$("input:text").keydown(function(evt){
if (evt.keyCode==13)
Result();
});
});

