0

I have several input boxes on a page, and I want the text to begin in the top-left. Currently, with what I am using below, it is aligned left, but in the middle of the box. I've tried vertical align and other things, but no luck. I don't want to use padding, because the text needs to wrap around and it will just make it pop out the top of the box:

<input style="height:200px;width:800px;font-family:Arial;border:1px solid #a6a6a6;
              background-color:#fff9eb;resize:none" wrap="hard"
              id="submitsummary" name="submitsummary"
              placeholder="1000 character limit..." 
              maxlength="1000" size="1000" type="text"/>

EDIT - So based on recommendations I've changed it back to textarea, I now have the textarea box in my HTML (simplified to show just it within the form):

<form id="submitform" name="submitform" action="submit.php" onsubmit="return validateSubmitForm()" method="post">

    <textarea style="height:60px;width:600px;font-family:Arial;border:1px solid #a6a6a6;
          background-color:#fff9eb;resize:none" wrap="hard" size="200" 
          placeholder="200 character limit..." maxlength="200"
          id="submitsummary" name="submitsumary" type="text"></textarea>

    <p id="submitsummaryfail"></p>
    <input type="submit" value="Submit" class="btn">
</form>

And what I'm trying to do is a validation function:

<script>
function validateSubmitForm()
{
    var submitsummary=$('#submitsummary').val();

    // check that summary isn't blank
    if (submitsummary==null || submitsummary=="")
        {
        $('#submitsummaryfail').html("Summary cannot be blank");
        return false;
        }
    else
        {
        $('#submitsummaryfail').html("");
        return true;
        }
}
</script>
cschippe
  • 81
  • 2
  • 10
  • This could be a a browser bug because when I try your code with Internet explorer, the text begins on the top left. And when I open it with Chrome, it begins on the middle on the box. – Xin Chen Jan 11 '13 at 22:25
  • Assuming you are talking about the text within the input, why don't you use textarea instead? it seems fitted. – alexb Jan 11 '13 at 21:45

1 Answers1

1

Based on your comment, you can use <textarea> and then fetch the value with jquery .val():

var text = $("#submitsummary").val();

https://stackoverflow.com/a/13321580/802791

Community
  • 1
  • 1
Mario S
  • 11,715
  • 24
  • 39
  • 47
  • For some reason this isn't working for me right now (it actually ends the jquery validation and let's the form submit, so something isn't working) – cschippe Jan 11 '13 at 22:12
  • @ChrisS Maybe you can show us the code you are trying to get working? – Mario S Jan 11 '13 at 22:17
  • Mario and @alexb, I updated the question above, would love to get your thoughts on why it's a no-go currently. Thanks so much – cschippe Jan 11 '13 at 22:26
  • Crap... I need to apologize to all of you guys for wasting your time, turned out in my 'if' statement I misspelled 'submitsummary' and that was causing all the havoc. I'm a moron, and again sorry to have wasted your time, thanks so much for all your help. – cschippe Jan 11 '13 at 22:38