这是我的javascript代码
$(document).ready(function() {
var count = 0;
$("#add_btn").click(function(){
count += 1;
$('#container').append(
'<table align="left" style="padding-left:120px; color:#6B1313; width:700px;" class="records">'
+'<tr>'
+'<td></td>'
+'<td>Only Alphabet</td>'
+'<td><input type="text" id="only_alphabet" name="only_alphabet" required ="required" onblur="number_validation()"/></td>'
+'</tr>'
+'</table>'
);
});
});
但是我无法调用number_validation javascript函数,并且onblur事件没有像我预期的那样运行。那么有人可以帮我解决这个问题吗?感谢
答案 0 :(得分:0)
var count = 0;
$(document).ready(function() {
$("#add_btn").click(function(){
count += 1;
$('#container').append(
'<table align="left" style="padding-left:120px; color:#6B1313; width:700px;" class="records">'
+'<tr>'
+'<td></td>'
+'<td>Only Alphabet</td>'
+'<td><input type="text" id="only_alphabet" name="only_alphabet" required ="required" /></td>'
+'</tr>'
+'</table>'
);
$('#only_alphabet').live('blur',function(){
number_validation();
});
});
});