为什么这段代码不起作用 [英] Why this code not Work
本文介绍了为什么这段代码不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好
为什么这段代码不起作用:
$( document )。ready( function (){
var textbox = document .getElementById( text1 );
// 事件键关闭,键盘输入和按键
textbox.onkeydown( function (){
alert();
});
}) ;
错误:
TypeError:textbox为null
html mvc:
@ {
ViewBag.Title =指数;
}
< h2 > 索引< / h2 >
< 输入 type = text id = text1 / < span class =code-keyword>>
i想学习javaascript和jquery什么是最好的书( 2013或2014)对于他们?
解决方案
( document )。ready( function (){
var textbox = document .getElementById( text1);
// 事件键关闭,键盘输入和按键
textbox.onkeydown( function (){
alert();
});
});
错误:
TypeError:textbox为null
html mvc:
@ {
ViewBag.Title =索引;
}
< h2 > 索引< / h2 >
< 输入 type = text id = text1 / < span class =code-keyword>>
i想学习javaascript和jquery什么是最好的书( 2013或2014)对于他们?
试试这个:
var textbox =
('#text1');
hello
why this code Not work :
$(document).ready(function () { var textbox = document.getElementById("text1"); //event key down and key up and keypress textbox.onkeydown(function () { alert(); }); });
error:
TypeError: textbox is null
html mvc :
@{ ViewBag.Title = "Index"; } <h2>Index</h2> <input type="text" id="text1 " />
i want to learn javaascript and jquery what is the best book (2013 or 2014) for them ?解决方案(document).ready(function () { var textbox = document.getElementById("text1"); //event key down and key up and keypress textbox.onkeydown(function () { alert(); }); });
error:
TypeError: textbox is null
html mvc :
@{ ViewBag.Title = "Index"; } <h2>Index</h2> <input type="text" id="text1 " />
i want to learn javaascript and jquery what is the best book (2013 or 2014) for them ?
Try this:
var textbox =
('#text1');
这篇关于为什么这段代码不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文