簡體   English   中英

為什么占位符屬性中的 and 在瀏覽器中不起作用

[英]why the &#10 and &#32 in the placeholder attribute doesn't work in the browser

關於"&#10"和“   ”如何在占位符屬性中協同工作的問題。 這是我的代碼:

render() {
 return(
   <div>{
      if this.state.showTextarea?
      <div> 
        <form> 
         <textarea  placeholder='ex:&#10;{"data":{&#10;&#32;"name":"petter"&#10;}&#10;}'> </textarea>
        </form>
      </div>
      : null
   } 
   </div>
);
}

這是顯示: 在此處輸入圖像描述

如果在代碼片段上運行,它工作得很好,但它在瀏覽器(chrome 和 Edge)中不起作用。 任何想法?

它不是標准的一部分。 您可以使用 Javascript 來完成。 https://github.com/bradjasper/jQuery-Placeholder-Newlines

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM