Trying to get the id of the element, like an elementary procedure, but does not find anything (undefined). Code:
function reserve() { alert(this.id); }; <a id="qweqwe" onclick="reserve();" href="#openModal2">тратата</a> So the same does not work:
alert($(this).attr('id')); jQuery connected
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
alert($('#qweqwe'));what returns? - Kernel Panicfunction reserve() { alert(this.id); };function reserve() { alert(this.id); };Should the item id be displayed? - Alexey Shimanskythisin the context of a function?) Why did you decide that it points to an element? - Alexey Shimansky