多个id上的jquery选择器 [英] jquery selector on multiple id
本文介绍了多个id上的jquery选择器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你有这样的HTML代码
Hi have a html code like this
<input type="text" value="quantita" id="quantita" name="quantita">
<input type="text" value="prodotto" id="prodotto" name="prodotto">
<input type="text" value="prezzo" id="prezzo" name="prezzo">
现在我正在尝试执行一个jquery代码,如果所有这些id的值都添加一个按钮与NULL不同
Now I'm trying to do a jquery code that add a button if the value of all these id is different from NULL
所以我这样做
var list = $("#prezzo", "#quantita", "#prodotto").val();
if (list!="")
{...do this...}
else
{....do nothing...}
但它不起作用
推荐答案
$("#prezzo,#quantita,#prodotto").each(function()
{
if ($(this).val() !="" )
{}
else
{}
});
这篇关于多个id上的jquery选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文