so I try to hide/show a div element with using onfocus and onblur:
<textarea onfocus="document.getElementById('divID1').style.display='block';" onblur="document.getElementById('divID1').style.display='none';"></textarea>
<div id="divID1">
This works fine, but the problem is that the div hides again when the textarea/input doesn't have focus anymore.
This is the whole code: JSFIDDLE link.
You can see that you can't check the Checkbox or select text.
What can I do to still display the div element when the textarea lost focus or to make the textarea still having focus when I clicked on the div?
Sorry, but I'm new to Javascript.
Thanks in advance,
Philipp
This question is not trivial, but according to this answer, it can be solved in the following way:
HTML
Javascript
JSFiddle: http://jsfiddle.net/PfQfN/4/ (works good with Firefox, Chrome, IE7-10, Safari and Opera). Or alternatively you can use this a bit modified code: http://jsfiddle.net/PfQfN/6/ (the effects are the same).
Updated CSS: And according to this very useful answer, those elements can be positioned better as shown in this fiddle: http://jsfiddle.net/PfQfN/9/