我想使用jQuery将以下代码打包到一个函数中,并从内联中调用该函数(例如: onclick、onchange等)。
function some_function() {
alert("Hello world");
}由(示例)调用:
<input type="button" id="message" onclick="some_function()" />这个问题很简单是有原因的。我似乎找不到合适的jQuery - to。
发布于 2010-08-27 10:31:35
您应该使用而不是使用内联事件处理程序来与jQuery一起使用。
使用不引人注目的代码:
function some_function() {
alert("Hello world");
}
$(document).ready(function(){
$('#message').click(some_function);
});https://stackoverflow.com/questions/3583275
复制相似问题