Reputation: 1
I am trying to get it so when the input isn't empty it will display what is in the input.
<div>
<input name="helpme" type="text" id="helpme" size="16" maxlength="32" value="">
</div>
<cfif helpme neq "">
<style>document.getElementById("a").style.display="block";</style>
</cfif>
<pre>
<font size=+1>
<div style="display:none" id=a>hello:
<font color=red>#trim(helpme)#</font>
</div>
</font>
</pre>
When you put an input in nothing happens.
Upvotes: 0
Views: 40
Reputation: 71
I found that a few ""
were missing around id names and updated the code a little but this works. Here there is a method triggered onkeyup so the value is looked for each time you type a character
function showValue() {
var input = document.getElementById('helpme').value;
document.getElementById('a').innerHTML = input;
}
<div>
<input name="helpme" type="text" id="helpme" size="16" maxlength="32" value="" onkeyup="showValue()"/>
</div>
<pre>
<font size=+1>
<p>hello: <font color="red" id="a"></font>
</p>
</font>
</pre>
Upvotes: 3