James
James

Reputation: 11

using html inside an input tag

I am trying to input a break tag at the end of each line of code so that it doesn't just read all in one line inside the input box. I have encoded the break tag as i thought that's how you can use html inside of an input box but for some reason it is just showing exactly what i have typed. Any help to correct this would be much appreciated.

This is what i have so far. I have only encoded one of the break tags for demonstration purposes, just to show you what i have done.

<div data-role="content" id="feedbackcontent">
      <form action="MAILTO:[email protected]" method="post" enctype="text/plain" id="fback">
        <label for="fname">Full Name:</label>
        <input type="text" name="fname" id="fname" data-clear-btn="true" placeholder="Your Full name..." required>
        <label for="email">Email:</label>
        <input type="text" name="email" id="email" data-clear-btn="true" placeholder="Your Email Address..." required email>
        <label for="comments">Comments (Optional):</label>
        <input type="text" name="comments" id="comments" data-clear-btn="true">

        <label for="deviceinfo" id="deviceinfo">Device Information:
        <input style="height:50px;" readonly name="deviceinfo" id="deviceinformation"/> 
        </label>

        <input type="submit" value="Send">  
      </form>
   </div>

</div><!-- /content -->

<script>
    document.addEventListener('deviceready', function(event) {
    var content = "";
    content += "Version: " + device.cordova + "&lt;br/&gt;";
    content += "Platform: " + device.platform + "<br/>";
    content += "Device Model: " + device.model + "<br/>";
    content += "Platform Version: " + device.version + "<br/>";
    content += "UUID: " + device.uuid + "<br/>";
    var element = document.getElementById("deviceinformation").value = content;

    }, false );     
</script>

Upvotes: 0

Views: 77

Answers (1)

Sverri M. Olsen
Sverri M. Olsen

Reputation: 13283

Input tags completely ignore newlines.

You can use a textarea instead. Textareas preserve whitespace.

<textarea name="theName">
You can have
Multiple lines
In textareas
</textarea>

Upvotes: 1

Related Questions