Javascript examples for jQuery Method and Property:siblings
Get the value of the Html element which is closed to the element which triggers the Event
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.8.3.js"></script> <script type="text/javascript"> $(function(){//from w ww .j av a2s . c om $("#eventtrigger").click(function(event){ console.log($(this).siblings('label').text()); }); }); </script> </head> <body> <label style="display:inline;">Information</label> <a id="eventtrigger">Click</a> </body> </html>