innerHtml with form elements Problem??
when i use innerHtml to add form elements, it causes some problems like ..hm.. the form elements are always created and destroyed immediately. I havent solved it, please help.
document.getElementById('text').innerHTML="<input type='password' name='pass'>";
<div id='text' onMouseOver="showtext();" onMouseOut="hidetext();">Login</div>
Is there someone that may help me?
The problem has to do with event bubbling. As soon as you mouseOver the text and it is replaced with an input element it triggers the mouseOut event. Unfortunately, you will not get very far using inline event triggers.
You should either A) Learn more about cross-browser event binding. B) Use jQuery. Or, C) try a different approach such as a button that shows/hides your login form.
I am not trying to be rude; hopefully this information saves you some frustration.
I wish you luck. May the source be with you
I just want to replace the text with input element. but I thank to you markle976 and DanInMA for your replies.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)