我只需要使用jQuery 选择器选择前一个元素.
<li class="collapsable">
<div class="hitarea collapsable-hitarea"></div>
<span id="devicelist" class="ankr">Device List</span>
<ul id="ultree">
<li type="dev" device="/dev/sdh1" id="dev0" class="litab">
<img height="20px" width="20px" src="../Images/drive.png" class="dicon">
<a class="ankr dn" href="#">'/dev/sdh1'</a>
</li>
</ul>
</li>
$(document).on("click","#devicelist,**Here Selector will be used**",this,function(event){
console.log(this);
console.log(event.target);
});
Run Code Online (Sandbox Code Playgroud)
我想选择有课程的div .hitarea
.我正在寻找类似的东西$("#devicelist:div.hitarea")
它应该只使用jQuery 的选择器来完成.
我想在元素上启用/禁用单击事件.我有以下代码......
HTML:
<a id="CP" style="cursor: pointer; text-decoration: underline;">Current Processes</a>
Run Code Online (Sandbox Code Playgroud)
jQuery的:
$(document).on("click", "#CP", function(event) {
$this = $(this);
$this.click(function() {
return false;
});
$this.html("Processing...").css({
"text-decoration": "none",
"cursor": "default"
});
$.ajax({
type: 'post',
url: 'abc.jsp',
success: function(process) {
//My code goes here...
$this.on("click"); // Here i want to bind or add handler which is fired previously.
}
});
});
Run Code Online (Sandbox Code Playgroud)