Adding placeholder attribute using Jquery

后端 未结 4 1602
面向向阳花
面向向阳花 2021-02-05 05:37

I have a simple problem. I just want to add a placeholder on an input. Here\'s the code:

HTML:


JQuery         


        
4条回答
  •  逝去的感伤
    2021-02-05 06:03

    Try something like the following if you want to use pure JavaScript:

    document.getElementsByName('link')[0].placeholder='Type here to search';
    

提交回复
热议问题