我在jsfiddle中有一些代码。我在表中有一个文本框,我想检查用户是否插入3000然后我想显示消息,如你是正确的
我的jquery代码是
$("#text10").keyup(function(){
$("#text10").blur();
$("#text10").focus();
});
$("#text10").change(function(){
var assetname = document.getElementById('text10').value;
if(assetname =$3000)
{
// alert('All Boxes have elements.');
$("#equal").show();
$("#equal a").html("CONGRATULATION ! YOU HAVE ENTERED APPROPRIATE BLOCKS FOR ACCOUNTING.");
}
else
{
$("#equal").show();
$("#equal a").html("CONGRATULATION ! YOU HAVE.");
}
});
在这里,您可以查看我的代码 - http://jsfiddle.net/vvQbm/5/
请帮忙
答案 0 :(得分:1)
$("#text10").keyup(function(){
$("#text10").blur(); // why you 'r using that?
$("#text10").focus(); // why you 'r using that?
});
$("#text10").change(function(){
var assetname = $(this).val();
if(assetname =='3000')
{
// alert('All Boxes have elements.');
$("#equal").show();
$("#equal a").html("CONGRATULATION ! YOU HAVE ENTERED APPROPRIATE BLOCKS FOR ACCOUNTING.");
}
else
{
$("#equal").show();
$("#equal a").html("CONGRATULATION ! YOU HAVE.");
}
});
答案 1 :(得分:1)
改变这个:
if(assetname =$3000)
You are not comparing correctly,you need to use == for comparison
到
if(assetname =='$3000')
更新了Fiddle