If I have:
<div id="selectbox" onclick="selectme();">
</div>
And if I call:
function selectme()
{
var divselection=$(this);
}
I can’t reference $('#selectbox'). What’s the best way of referencing back to the div without having to passing it through as a variable?
You can’t. You have 3 possibilities:
onclick="selectme(this);"Fetch it by id:
Not mix markup and javascript and attach the onclick handler unobtrusively:
and then in a separate javascript file: