如何使用jquery在HTML表中查找文本框值 [英] How to find textbox value is in HTML table using jquery
本文介绍了如何使用jquery在HTML表中查找文本框值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的朋友们,
我设计了文本框,并在html表格下面。这些值从文本框动态添加到html表格。
我的问题是:当我需要在表中添加已有的值时,我需要弹出已经存在
什么我试过了:
Dear Friends,
I designed the textboxes and below html table..The values add dynamically to html table from text box.
My problem is: when i need to add already existing value in table, i need popup "Already Exist"
What I have tried:
$(".add-row").click(function(){
var invno = $(".addInvNo").val();
var invdate = $(".addInvDate").val();
var rowCount = $('#tblInvoices tr').length;
if(rowCount>1){
$("#tblInvoices").find(".tdinvno").each(function(){
if($(this).html()==invno){
alert("Invoice Already Exist");
}
else {
var markup = "<tr class='addvalues'><td align='center'></td><td class='tdinvno'>" + invno + "</td><td>" + invdate + "</td><td><input type='button' class='del-row' value='Delete' onclick='deleteRow(this)'></td></tr>";
$("#tblInvoices").append(markup);
}
});
}
else if(rowCount<=1)
{
var markup = "<tr class='addvalues'><td align='center'></td><td class='tdinvno'>" + invno + "</td><td>" + invdate + "</td><td><input type='button' class='del-row' value='Delete' onclick='deleteRow(this)'></td></tr>";
$("#tblInvoices").append(markup);
}
});
推荐答案
(。add-row ).click(function(){
var invno =
(".add-row").click(function(){ var invno =
(。addInvNo)。val();
var invdate =
(".addInvNo").val(); var invdate =
(。addInvDate)。val();
var rowCount =
(".addInvDate").val(); var rowCount =
这篇关于如何使用jquery在HTML表中查找文本框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文