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 comment
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 comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...