Jquery gets the value method of the currently clicked object


Example: gets the value of li in ul

First, in HTML we set the value for each li


<ul>
<li value=" hello "></li>
<li value="hello"></li>
<li value="=-="></li>
</ul>

Then get the corresponding value according to the click event through jquery


$(document).ready(function(){
$("li").click(function{
alert($(this).val());
});
});