First of all, I am not looking for jQuery solution, just simple pure Javascript code, inside of an element.
Let’s say we have following html code:
<select onmousedown=" ??? ">...</select>
I want a simple script inside of the element to show popup message alert() with information which button was pushed down and what is a relative position of the element to the document <body> – something like offset() in jQuery.
Create a JavaScript function with some name and then call it on
onmousedownevent passing theeventandthisobject which can be used inside the function.HTML
JS
If you plan to use jQuery then you can use this script
Update:
If you want inline script then try this.