0

I am new to this. I recently started learning HTML/JavaScript/PHP.

I have created a form that a user can type information into and update any changes they have made.

I used the Textarea as the information being requested is quite large. When someone wants to update the information they entered before, a PHP code I wrote displays the information previously written:

  <textarea class="datainput" row="4" cols="60"><?php echo $dataInput['data_input'];?></textarea>

All works fine except, the cursor is not in a fixed position at the start when the user first enters the information.

It appears in the middle of the first row of the Textarea.

How do I set the cursor position to the top left corner (start)?

kevz62
  • 11
  • 1
  • Are you sure your HTML looks exactly like that? You haven't reformatted it for the question? – Quentin Feb 10 '15 at 13:35
  • @Quentin it looks exactly like that. – kevz62 Feb 10 '15 at 13:37
  • If it looks like that, and the user is entering data for the first time (i.e. `data_input` is empty) then what you describe is not how textareas behave. – Quentin Feb 10 '15 at 13:42
  • Does it line break and start from the beginning or is that in the middle as well? – Waxi Feb 10 '15 at 13:47
  • @slime it does not line break, the cursor always appears on the first row but in the middle of the first row (if that makes any sense). – kevz62 Feb 10 '15 at 13:52
  • Cannot reproduce: http://jsbin.com/juwamigupo/1/edit?html,output – Quentin Feb 10 '15 at 14:17
  • I found a solution, I changed the Textarea tag the Input tag and called the php function in the value attributes and all works fine. Thank you so much for your help! – kevz62 Feb 10 '15 at 15:37

0 Answers0