Home > Web Front-end > JS Tutorial > body text

jquery gets the value method of the currently clicked object_jquery

WBOY
Release: 2016-05-16 16:57:51
Original
1453 people have browsed it

Example: Get the value of li in ul

First, in html we need to set the value for each li

Copy code The code is as follows:







Then click through jquery The event gets the corresponding value
Copy the code The code is as follows:

$(document).ready( function(){
$("li").click(function{
alert($(this).val());
});
});
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template