Jump to content

[SOLVED] input preview


daveoffy

Recommended Posts

So I have a submit form, and I want it, so after filling in each form(or while filling it in) it shows a preview on the side.

 

How can I make it so, when I enter Hi, in a form named title, it shows up somewhere else on that page?

 

Thanks in advance. If this is not possible in PHP please tell me. I think it might be javascript.

Link to comment
Share on other sites

Yep it's javascript.

 

<div id="preview"></div>
<textarea rows="5" cols="50" onchange="updatePreview(this)"></textarea>
<script type="text/javascript">
<!--
function updatePreview(e) {
    var id = document.getElementById("preview");
    id.setNodeValue(e.getNodeValue());
}
//-->
</script>

 

I'm no JavaScript expert so the code may be a bit off. I used the DOM API but I'm not sure in how far browsers actually support this.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.