0

I wonder could anyone help with this. I'm making a Java compiler app through phonegap and I have a textarea in which I would just like to have the Java Class name already default in the text box(and it not disappear)

So I have as follows

    <div>
            <label for="source">Source Code:</label>
            <textarea cols="35" rows="10" name="source" id="source" value="class TryMe{"></textarea>
        </div>

        <div>
            <label for="input">Input: <span class="description">(Data that will be given to the program on the stdin.)</span></label>
            <textarea cols="35" rows="3" name="input" id="input"></textarea>
        </div>

        <div>

and just to highlight what I mean I've added "value= "class TryMe{" just so you know what I mean. Is it easiest to just make a javascript function.

Leah Buchanan
  • 31
  • 1
  • 4
  • possible duplicate of [How to add default value for html – Jukka K. Korpela Feb 01 '14 at 16:00

2 Answers2

0

Setting a default value for an html <textarea> is like this

<textarea cols="35" rows="10" name="source" id="source">  VALUE HERE  </textarea>
Rob Sedgwick
  • 5,216
  • 4
  • 20
  • 36
0

Textareas do not have a value attribute. You simple add the text within the element

<textarea>class TryMe{</textarea>

You can also use placeholders

<textarea placeholder="class TryMe{"></textarea>
Cjmarkham
  • 9,484
  • 5
  • 48
  • 81