jquery Operation Example

Source: Internet
Author: User

When you click Edit, get the content implementation method for editing sibling tags:

<! DOCTYPE html>

<meta charset= "UTF-8" >

<title></title>

<body>

<table>

<thead>

<tbody>

<tr>

<td>1</td>

<td>2</td>

<td>3</td>

<TD onclick= "Get_prev (this);" > Edit </td>

</tr>

</tbody>

</thead>

</table>

<script src= "Jquery-3.1.0.min.js" type= "Text/javascript" ></script>

<script type= "Text/javascript" >

function Get_prev (ARG) {

$ (ARG). Siblings (), which denotes all brother tags

Map loops through each label in multiple tags,

Each tag is looped to execute a function inside the map and get its return value (first return value 1, second 2, third 3)

Encapsulates all the return values into an array (list),

Last return list

var list = $ (ARG). Siblings (). Map (function () {

Labels for the current loop

return $ (this). text ();

});

Console.log (list[0],list[1],list[2]);

}

</script>

</body>


This article from "Flat Light is true" blog, please be sure to keep this source http://ucode.blog.51cto.com/10837891/1850649

jquery Operation Example

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.