JQuery fades out after the table text box fades in and changes the value, jquery fades in

Source: Internet
Author: User

JQuery fades out after the table text box fades in and changes the value, jquery fades in

This article is divided into two sections: html code and jquery Code. The Code is very simple. You can refer to it!

Html code

<Table style = "border: 1px solid blue "> <tr> <th> id </th> <th> name </th> <th> age </th> <th> sex </th> <th> operation </th> </tr> <td class = "td1"> 1 </td> <td class = "td1"> beads </td> <td class = "td1"> 21 </td> <td class = "td1"> female </td> <td class = "td2"> </td> </tr> <td class = "td1"> 2 </td> <td class = "td1"> Chen </td> <td class = "td1"> 18 </td> <td class = "td1"> male </td> <td class = "td2"> </td> </tr> </table>

Jquery code

<Script> var a; $ (document ). ready (function () {$ ("td [class = 'td1 ']"). click (function () {var tdlist = $ (this ). parent (). children (); // get tda = "<tr style = 'display: none'>"; tdlist. each (function (I) {var text = tdlist. eq (I ). text (); if (tdlist.eq( I ).html (). indexOf ("input") <0 &tdlist.eq( I ).html (). indexOf ("button") <0) {if (tdlist. length = (I + 1) {a + = "<td> <button> OK </button> </td>";} else if (I = 0) {a + = "<td> <Input type = 'text' readonly = 'true' value = '"+ text +"'> </td> ";} else {a + = "<td> <input type = 'text' value = '" + text + "'> </td> ";}}}); a + = "</tr>"; $ (this ). parent (). after (). next (). fadeIn ("3000") ;}); $ (this ). delegate ("button", "click", function () {var list = $ (this ). parent (). parent (). children (); // The current td value var li = $ (this ). parent (). parent (); // The current trlist. each (function (I) {var B = list. eq (I ). children (). eq (0 ). val (); // The current input value var shngjitd = li. prev (). children (); // The previous tdif (list. length! = (I + 1) {shngjitd. eq (I ). text (B); li. fadeOut ("3000");} else {list. eq (I ). text ("") ;}}) ;}); </script>

The above is a small series of jQuery Implementation Table text box fade in to change the value and fade out effect, I hope to help you, if you have any questions, please leave a message, the editor will reply to you in a timely manner. Thank you very much for your support for the help House website!

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.