jquery hover hasClass insertBefore live blockUI children notice
hover
$(".onenote").hover(function(e) { $(this).children(".newnote_right_icon").removeClass("div_beHidden"); e.stopPropagation(); }, function() { $(this).children(".newnote_right_icon").addClass("div_beHidden"); });
hasClass
$(".onenote").click(function() { var obj = $(this).parent().children(".addCommentDiv")[0]; if ($(obj).hasClass("div_beHidden")) { $(obj).removeClass("div_beHidden"); } else { $(obj).addClass("div_beHidden"); } });
live 和直接click的区别是以后新添加的元素也会受影响
$(".deleteComment").live("click",function(e){ $(this).parent().parent().parent().remove(); e.stopPropagation(); });
hover的live写法
$(".onecomment").live('hover',function (ev) { if (ev.type == 'mouseover') { $(this).children().children(".right").removeClass("div_beHidden"); } if (ev.type == 'mouseout') { $(this).children().children(".right").addClass("div_beHidden"); } });
insertBefore
$(".submitCommit").click(function() { $('.CommitTemplate').clone().removeClass("div_beHidden").removeClass("CommitTemplate").insertBefore($(this).parent().parent().parent()); $(this).parent().parent().parent().addClass("div_beHidden"); });
blockUI
<script type="text/javascript" src="jquery/blockui/jquery.blockUI.js"></script> openWaitBlock(); $.post(url,params,function(data){ closeWaitBlock(); if(data.status=="1"){ parent.$.fn.ceebox.closebox(); alert("Your message was sent successfully."); }else if(data.status=="-1"){ $("body").html("The session time out."); }else if(data.status=="0"){ $("body").html("Error"); } },"json");
function openWaitBlock(message, timeout){ if(!message){ message = "<div style='font-size: 20px; float: right;'><img src='images/ajax-loader.gif'/></div>"; } $.blockUI({ css: { border: 'none', padding: '15px', backgroundColor: '', '-webkit-border-radius': '10px', '-moz-border-radius': '10px', opacity: .5, color: '#fff', width: '15%' }, message:message }); if(timeout){ setTimeout($.unblockUI, timeout); } }
find children
$("#myjobpost_status_list>li.wh>span") copyTR.children().children("b.name").attr("onClick","checkCandidates("+list[i].rojid+");");
copyTR.find("b>img.isCheck").attr("src","images3/checked.png");
copyTR.find("b.name")
notice jquery.notice.js
function notice(data){ if(data != null && data.length >0 ){ jQuery.noticeAdd({ text: data }); } }
相关推荐
MaureenChen 2020-03-01
HSdiana 2019-12-27
lunareclipse 2019-12-23
Uching 2006-11-13
PHP基础学习 2019-01-15
dazhifu 2019-07-01
刁连通 2019-01-15
NARUTOLUOLUO 2016-07-11
vavid 2016-01-16
yaodilu 2019-06-27
sorryericsson 2014-11-18
realitycss 2014-07-24
AlisaClass 2014-05-05