I have following code:
HTML:
// import jQuery
<tr id = "tr_id">
<td>something</td>
<td>something</td>
</tr>
<div>
<span class = "cls">something</span>
<a id="a_id" href="#">something</a>
</div>
JavaScript:
var result;
$("tr, .cls").on("click", function(){
if (/* selector is "tr" */) {
result = $(this).attr("id");
} else{
result = $(this).closest("a").attr("id");
}
});
Now I want to know how can I write a condition in this if
statement?
if (/* selector is "tr" */) {