I want to display the input from a input-box text, right beside the input-box if it got data.
I want to use it in our checkout for the customer name. That when the customer has entered their name, it echo beside it "Hi (customer-name)"
The input-box is on the same page. So the echo needs to be displayed right beside the input-box.
The data needs to be displayed when the customer is not focussing anymore on this input-box. So when it clicks on an other input-box or beside it, it needs to be displayed.
How can I fix that?
If you are OK with pure inline javascript, you can attain this using onblur event:
<input type="text" value="" onblur="if(this.value !=''){document.getElementById('hi').innerHTML='Hi, '+this.value;}else{document.getElementById('hi').innerHTML='';}" />
<span id='hi'></span>
Empty span, or whatever other html place holder will fill with "Hi, (username)" if the input loses focus and is not empty.