I need to show div above button on button click with jquery.
$("#but button").click(function(){
$("#mydiv").css("display","block");
});
<div id="but"><button type="button">Show Div!</button></div>
<div id="mydiv" style="display: none;">The div must be above button</div>
UPDATE
I need to make as a tooltip above the button.
I recommend taking an hour to read through the jQuery API documentation. It literally only takes that long, but pays off enormously.
Update
Your edit about making it a tooltip completely changes the question. You’d probably want to position the div using
position: absoluteand give itleftandtopcoordinates relative to the button, like this:Live Example | Source
Original answer:
The most obvious thing would be to change the markup so the div is in the right place to start with.
It’s hard to tell what you’re asking, but if you want to move
#mydivabove#but:Live Example | Source
But if you want to put it before the button but inside
#but:Live Example | Source