HTML Input - already filled in text

前端 未结 5 1806
太阳男子
太阳男子 2020-12-29 02:59

I was wondering, is there a way to put text into an input field? What i\'ve got now is a placeholder, but that\'s actually an empty inputfield. So that\'s not what i\'m look

相关标签:
5条回答
  • 2020-12-29 03:11
    <input type="text" value="Your value">
    

    Use the value attribute for the pre filled in values.

    0 讨论(0)
  • 2020-12-29 03:24

    All you have to do is use the value attribute of input tags:

    <input type="text" value="Your Value" />
    

    Or, in the case of a textarea:

    <textarea>Your Value</textarea>
    
    0 讨论(0)
  • 2020-12-29 03:25

    The value content attribute gives the default value of the input element.

    - http://www.w3.org/TR/html5/forms.html#attr-input-value

    To set the default value of an input element, use the value attribute.

    <input type="text" value="default value">
    
    0 讨论(0)
  • 2020-12-29 03:31

    You seem to look for the input attribute value, "the initial value of the control"?

    <input type="text" value="Morlodenhof 7" />
    

    https://developer.mozilla.org/de/docs/Web/HTML/Element/Input#attr-value

    0 讨论(0)
  • 2020-12-29 03:32

    TO give the prefill value in HTML Side as below:

    HTML:

    <input type="text" id="abc" value="any value">
    

    JQUERY:

    $(document).ready(function ()
     {
      $("#abc").val('any value');
     });
    
    0 讨论(0)
提交回复
热议问题