我有一个文本框,它使用ajax从另一个文件加载。 在ajax.php中
<input type='text' id='ew' name='ew' value='0' class='ew' />
在index.php中加载
<div id='ew1'></div>
脚本是这样的
$(document).ready(function() {
$('input.ew').keyup(function(){
if(!isNaN(this.value) && this.value.length!=0){
var ew_ew = $(this).val();
alert(ew_ew);
}
});
});//ready
但我没有得到任何值(value)
最佳答案
确认您已成功将 jQuery 包含到页面中并尝试此操作
$(document).ready(function() {
$('.ew').keyup(function(){
if(!isNaN($(this).val()) && $(this).val().length!=0){
var ew_ew = $(this).val();
alert(ew_ew);
}
});
});//ready
关于jquery获取ajax加载文本框的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30412424/