javascript document.ready没有运行 [英] javascript document.ready not running
本文介绍了javascript document.ready没有运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨。
在我的MVC项目中,我有一个必须触发脚本的按钮。
当它发生时,页面没有不要听这个活动。
我把脚本放在我的视图里面。
这是有效的
Hi.
In my MVC project I have a button that has to trigger a script.
As it happens the page doesn't listen to the event.
I put the script in my view where the form is.
this works
<script >
alert("it worked");
</script>
这不起作用
this doesn't work
<script >
$(document).ready(function () {
$("#btnSubmit").click(function () {
alert("it worked");
</script>
这不起作用
this doesn't work
<script >
$(window).load(function () {
$("#btnSubmit").click(function () {
alert("it worked");
</script>
更新:
这项工作
UPDATE:
this works
<script>
$(document).ready(function () {
alert("mmm");
});
</script>
所以这是点击事件不起作用
在网上找不到任何解决方案
提前致谢
so it's the click event that's not working
Can't find any solution on the net
Thanks in advance
推荐答案
(文件).ready(function(){
(document).ready(function () {
(#btnSubmit)。 click(function(){
alert(it working);
< / script>
("#btnSubmit").click(function () { alert("it worked"); </script>
这不起作用
this doesn't work
<script >
(window).load(function(){
(window).load(function () {
这篇关于javascript document.ready没有运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文