我的按钮点击检测器怎么了?
$('.start2').on('click', function() {
这是按钮
<button class="start2">START</button>
答案 0 :(得分:2)
没事的话,您只需传递一个回调函数即可完成
示例:
$('.start2').on('click', function() {
console.log("hello")
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<button class="start2">START</button>
答案 1 :(得分:0)
据我所见,您失踪了}
$('.start2').on('click', function() {
console.log('clicked!!!');
});
答案 2 :(得分:0)
export {};
socket.on('connect', function() {
socket.send('Admin connected');
});
第一个功能有效,第二个功能无效
答案 3 :(得分:0)
点击后,您需要使其做。
<button class="start2" onclick="return funcName(input_you_can_choose_to_not_have_it);">START</button>
然后,您只需在调用函数(funcName)时添加代码。 喜欢(用Javascript):
<script>
</script>
<script>
var notLocal = null; // No need to add it
var funcName = function (input) {
var localVarible = input;
notLocal = input + " RAN THIS PROJECT!!!";
//Haha it was just a joke
console.log("Something else...");
console.log(notLocal);
//Do more!!!
};
</script>
有帮助吗?