$('li').click(function(event){})
$('li')
.bind('click',function(event){})
.bind('click',function(event){})
$('li')
.bind('click',function(event){})
.bind('click',function(event){})
$('li').unbind('click')
$('li')
.bind('click.editMode',function(event){})
.bind('click.displayMode',function(event){})
$('li').unbind('click.editMode')
$("p").one("click",function(){
$(this).animate({fontSize: "+=6px"});
})
//先给元素添加事件
$("p").click(function(){
$(this).slideToggle();
})
//再把元素的事件删除
$("button").click(function(){
$("p").unbind();
})
var e = jQueery.Event("click")
jQuery("body").trigger(e);
var e = jQuery.Event("keydown", {keyCode : 64});
jQuery("body").trigger(e);
$("p").click({param1 : "Hello", param2 : "World"}, someFunction);
function someFunction(event){
alert(event.data.param1);
alert(event.data.param2);
}
$("p").click(function(event){
alert(event.target.nodeName);
})
$("p").on("click", function(){
alert("hello");
})
$("button").click(function(){
$("p").off("click");
})
$("#foo").on("click",function(){
alert($(this).text());
})
$("#foo").trigger("click");
$("#foo").on("custom", function(event, param1, param2){
alert(param1 + "\n" + param2)
})
$("#foo").trigger("custom",["Custom","Event"]);
var event = jQuery.Event("logged");
event.user = "foo";
event.pass = "bar";
$("body").trigger(event);
$("body").trigger({
type: "logged",
user: "foo",
pass: "bar"
});
//给一个元素绑定一个focus事件
$("input").focus(function(){
$("<span>Focused</span>").appendTo("#id").fadeOut(1000);
})
//用triggerHandler触发
$("#id").click(function(){
$("input").triggerHandler("focus");//不会触发focus的默认行为,即进入文本框
})
//用trigger触发
$("#id").click(function(){
$("input").trigger("focus");//同时触发foucs的默认行为和绑定行为
})
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <body> <div> <p><a href="#foo"><span>I am a Link!</span></a></p> <p><a href="#bar"><b><i>I am another Link!</i></b></a></p> </div> </body> </html>
$(function () {
$('*').add([document, window]).on('click', function(event) {
event.preventDefault();
console.log(this);
});
});
$(function () {
$('a').on('click', function(event) {
event.preventDefault();
console.log($(this).attr('href'));
});
});
<html> <body> <div id="container"> <ul id="list"> <li><a href="http://domain1.com">Item #1</a></li> <li><a href="/local/path/1">Item #2</a></li> <li><a href="/local/path/2">Item #3</a></li> <li><a href="http://domain4.com">Item #4</a></li> </ul> </div> </body> </html>
$( "#list a" ).on( "click", function( event ) {
event.preventDefault();
console.log( $( this ).text() );
});
$( "#list" ).append( "<li><a href='http://newdomain.com'>Item #5</a></li>" );
$( "#list" ).on( "click", "a", function( event ) {
event.preventDefault();
console.log( $( this ).text() );
});
$('img[src*=small]').toggle({
function(){},
function(){},
function(){}
});
$(element).mouseenter(function(){}).mouseleave(function(){})
$("p").hover(function(){
$("p").css("background-color","yellow");
},function(){
$("p").css("background-color","pink");
});
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有