Append <tr> ID parameter to JS function from append

Source: Internet
Author: User

Today, this little problem almost breaks my whole.

$.each (data.list, function (index, item) {i++;                     Shenhe = "Pending Review"; tixing = Item. Type = = "0"?                     "Judgment question": "Single Choice"; if (item. Approvalstate = = "N" | | Item. Approvalstate = = "Y") {Shenhe = Item. Approvalstate = = "N"?                     "Failed": "Passed"; } $ ("#questionTable"). Append ('<TR><TDstyle= "Display:none">' + item.id + '</TD><TDHeight= "+"class= "TDD">' + i + '</TD><TD><astyle= "color: #39F; width:60px;"href= "wyct.html"><Div>' + Item. Question + '</Div></a></TD><TD>' + tixing + '</TD><TD>' + Shenhe + '</TD><TD><Div>' + Item. Advice + '</Div></TD><TD><Tablestyle= "padding-left:10px;"><TR><TDstyle= "border-top:none; border-right:none; Border-bottom:none; "><astyle= "COLOR: #39F"href= "wyct.html">Edit</a></TD><TDstyle= "border-top:none; border-right:none; border-bottom:none;"><astyle= "color: #39F;"ID= "' +item.id+ '" onclick= "deletelist (' +item.id+ ');" > Delete </a  ></TD></TR></Table></TD><TD>' + timeformatter (item. Submittime) + '</TD></TR>'); });
The above code is I get the ID value from the database , and both are correct, but write the item in the delete there. ID want to pass to the DeleteList function is not passed, tried a lot of ways, but in the form of append append is not passed the string type value. Daoteng used it after a morning.
<a style= "color: #39F;" id= "' +item.id+ '" onclick= "deletelist (this.id);" > Delete </a>
Solve the problem successfully. One of the twists and turns sad not to say, Rookie of sorrow Ah

Append <tr> ID parameter to JS function from append

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.