JQ through TD to obtain peer other list TD method _jquery

Source: Internet
Author: User

Suppose you have the following style sheet structure

In the tabulation, take the hands-on steps to teach you to write tables in the SPRINGMVC without frames, as shown below

function Refreshtable (OBJS) {
	$ ("#ObjTables"). HTML ("");
    For (i in OBJS) {
  	  if (objs[i].obj_type!= "FRAME") {
  	  $ ("#ObjTables"). Append ("<tr><td>" +objs[i].obj _id+
          "</td><td>" +objs[i].obj_name+ "
          </td><td>" +objs[i].ziduan_name+ "
          </ Td><td> "+objs[i].obj_type+" ("
          </td><tr>");
  	  } else{
  		  $ ("#ObjTables"). Append ("<tr><td>" +objs[i].obj_id+
            "</td><td>" +objs[i]. obj_name+
            "</td><td>" +objs[i].ziduan_name+ "
            </td><td id= ' >" +objs[i].obj_ type+ "<button onclick=" getframecontent (This) ' data-toggle= ' modal ' data-target= ' #myModal ' >+</button> ' +
            "</td><tr>");
  	  }
     }
;

Unlike the blog written before, it is here, through the objs of the Obj_type, a differentiated tabulation, and then, for Type frame row, add button option to show more tables, that table has tables, this feature has the opportunity to introduce

noticed that

Getframecontent (This)

When you click this button, the method is called

function Getframecontent (frameselect) {
    //get a clicked line of tr   var tr = $ (frameselect). Parent (). parent ();
    Gets all TD element
   var B = A.children ("TD") of TR;
    Get the third column element
   var c = B.eq (2);
    Displays the value of the third column
   var d= c.text ();
	alert (d);
}

Here function inside in order to demonstrate, did not do the concrete operation, is obtains through these several statements to hit one row third column The value, the other column is same.

If you want to get other rows (which are rarely the case), you need to be in the first sentence

var tr = $ (frameselect). Parent (). Parent (). parent ();

Get to the table element, or directly with $ ("#XXX"), but that's not directly related to a specific button we clicked.

Finally, the page popup effect

It worked.

The above is a small series for you to bring JQ through TD to get peer other listed TD's method all content, I hope we support cloud-Habitat Community ~

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.