考虑以下两个代码示例:
// Example 1
$('#myButton').click(function() {
alert('I was clicked');
});
// Example 2
$('#myButton').click(
alert('I was clicked');
);
为什么具体示例 2 不起作用?
考虑以下两个代码示例:
// Example 1
$('#myButton').click(function() {
alert('I was clicked');
});
// Example 2
$('#myButton').click(
alert('I was clicked');
);
为什么具体示例 2 不起作用?