Jquery obtains the control value operation TR in tr.

Source: Internet
Author: User
<Table Style = "width: 100%; height: 100% "border =" 1 "> <caption> material/special tool marshal/tool cantainer/transportation/mobile </caption> <tbody> <tr> <TD> Project No </ TD> <input type = "hidden" name = "hidprojectinnerid" id = "hidprojectinnerid"> <input name = "txtprojectno" type = "text" id = "txtprojectno" class = "error"> <a href = "javascript: void (0) "onclick =" selectproject (); "> select </a> </TD> <TD> final custome: </TD> <span id = "labfinalcustome"> label </span> </TD> <TD> Order No. </TD> <span id = "laborderno"> label </span> </TD> <TD> Project Leaing time: </TD> <span id = "labprojectleaingtime"> label </span> </TD> </tr> <TD colspan = "8"> exchange rate: 8.3000 </TD> </tr> <tr align = "center"> <TD> item </TD> <TD colspan = "2"> description </TD> <TD> qty </TD> <TD> Unit </TD> <TD> total </TD> <TD> remark </TD> <a id = "newitem" href = "javascript: void (0) "> newitem </a> </TD> </tr> </tbody> <tbody id =" tbitem "> <tr align =" center "> <TD> </ TD> <TD colspan = "2"> </TD> </ TD> </tr> <tr id = "tbitem1" align = "center"> <TD> <select id = "selitem" name = "item "> <option value =" material "> Material </option> <option value =" mobile "> mobile </option> <option value =" Others "> others </Option> <option value = "specialtoolrental"> special tool rental </option> <option value = "toolcontainer"> tool container </option> <option value = "transportation"> transportation </option> <option value = "workinghours"> workinghours </option> </SELECT> </TD> <TD colspan = "2"> <input id = "txtdescription" Style = "width: 90% "type =" text "name =" item "> </TD> <input id =" txtqty "type =" text "name =" item "> </ TD> <input id = "txtunit" type = "text" name = "item"> </TD> <input id = "txttotal" type =" text "name =" item "> </TD> <input id =" txtremark "type =" text "name =" item "> </TD> <TD> <a href = "javascript :; saveitem ('tbitem1') "> Save </a> | <a href =" javascript:; delitem ('tbitem1 ') "> Delete </a> <input id =" txtinnerid "type =" hidden "name =" item "> </TD> </tr> </tbody> </table>
Function saveitem (INDEX) {var TR = $ ("Tr [ID =" + index + "]"); var innerid = tr. find ('input [ID $ = txtinnerid] '). val (); var item = tr. find ("select [ID * = selitem]"). val (); var des = tr. find ('input [ID $ = txtdescription] '). val (); var qty = tr. find ('input [ID $ = txtqty] '). val (); var unit = tr. find ('input [ID $ = txtunit] '). val (); var Total = tr. find ('input [ID $ = txttotal] '). val (); var remark = tr. find ('input [ID $ = txtremark] '). val (); // alert (innerid + "/" + item + des + qty + unit + total + remark ); // verify the Project ID var proinnerid = $ ("# hidprojectinnerid "). val (); If (proinnerid = "") {$ ("# txtprojectno "). removeclass ("field"); $ ("# txtprojectno "). addclass ("error"); Return false;}/* jquery. ajax ({type: 'get', URL :'.. /handler/projectreport. ashx', data: {"key": "save", "proinnerid": $ ("# hidprojectinnerid "). val (), "innerid": innerid, "type": type, "content": content, "startdate": startdate, "enddate": enddate, "remark ": remark}, cache: false, success: function (result) {var jsonobj = eval (result); If (jsonobj [0]. result = "true") Alert ("sueecss"); else alert ("error") ;}}); */} function delitem (INDEX) {var TR = $ ("Tr [ID =" + index + "]"); // var innerid = tr. find ('input [ID $ = txtinnerid] '). val (); $ ("Tr [ID =" + index + "]"). remove ();}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.