jQuery click () method
Examples
Click <p> element when the alarm text:
$("p").click(function(){
alert("段落被点击了。");
});
alert("段落被点击了。");
});
try it"
Definition and Usage
When you click the element, click event occurs.
click () method triggers the click event, or when a predetermined function to run the event click event.
grammar
Trigger the selected element click event:
$(selector).click()
尝试一下
Add the function to the click event:
$(selector).click(function)
尝试一下
参数 | 描述 |
---|---|
function | 可选。规定当 click 事件发生时运行的函数。 |