Jump to content

HTML code to copy from another text box and hide if empty

Recommended Posts

Hi there,


I have a form with a field, which will be prefilled, but this field is a text box and editable for everyone. But i want it only as a readonly field, but this field can´t be changed directly to a html field, so i was wondering, is it possible to copy the body of that field and show it as readonly and only, if it is not empty?


I do not want to use a button for that


Thanks a lot in advance



Link to post
Share on other sites

Could you tell me more specific what you want to do?


As I see it, you've got in input field with type=text and you want to copy the text from this input field into another element.

I should do this with javascript:

var text = document.getElementById("[id of the input field]").value;

document.getElementById("[id of the other element]").innerHTML = text;
  • Like 1
Link to post
Share on other sites

Join the conversation

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

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...