4 回答

隔江千里
简介:jq是js的一个框架,定义函数,其实就是js定义函数,而调用函数时,是通过事件触发的。
函数定义:function funtionName(){}
调用函数:
举例说明:
<input type="text" name="username" id="username" value=""/>
<input type="button" id="check" value="验证"/>
<script>
$(function(){
$("#check").click(function(){
check_username();
})
});
function check_username(){
if(!$("#username").val())
{
alert("姓名为空");
}
}
</script>

交互式爱情
试试改成这样:
1 2 3 4 5 6 7 8 9 10 11 | <script> (function($){ $.render = function(jq){ alert("这里是jquery代码"); } })(jQuery);
$(function(){ $.render(null); }); </script> |
相关问题推荐
慕课专栏
更多
添加回答
举报
0/150
提交
取消