請問方式一中手動指定觸發(fā)事件是什么意思?
$("#test").click(function(){ ?????$("ele").click()??//手動指定觸發(fā)事件? });
這兒是什么意思喲?
怎么在點擊事件的函數(shù)里又有一個點擊事件啊?
譬如,我自己做了個小測試:
<div> ????<p>Test</p> </div> <script> ????$("div").click(function(){ ????????$("p").click().css("border","2px?solid?black"); ????}) </script>
這完全不對嘛,邏輯不對結果也不對呀,求各位大佬不吝指教,謝謝。
2018-11-09
有兩個獨立單擊事件,當單擊第二個時,事件回調里又是個單擊第一個的事件。
2018-11-09
是你理解錯了,人家的意思是:
<!DOCTYPE html>
<html>
<head>
? ? <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
? ? <title></title>
? ? <style>
? ? .test2 {
? ? ? ? background: #bbffaa;
? ? }
? ? .test3 {
? ? ? ? background: yellow;
? ? }
? ? .test2,.test3{
? ? ? ? border: 1px solid red;
? ? }
? ? </style>
? ? <script src="http://idcbgp.cn/static/lib/jquery/1.9.1/jquery.js"></script>
</head>
<body>
? ?<div>
? ? <p>Test</p>
</div>
?<div>
? ? <p>Test2</p>
</div>
<script>
? ? $("div:first").click(function(){? ? ? ? ?
? ? ? ? $("p").css("border","2px solid black");? ??
? ? })
? ? ?$("div:last").click(function(){
? ? ?$('div:first').click()
? ? ? ?
? ? })
</script>
</body>
</html>
2018-11-04
//我也是剛學習jQuery
單擊id為test的div會觸發(fā)$("#test)?.click() 這個點擊事件,只有當$("#test)?.click()事件被觸發(fā) 才能觸發(fā)
$(
"ele"
).click()事件