简体   繁体   English

将textarea中的特定文本设为粗体

[英]Make a particular text in textarea to be bold

I have 2 notes which are displayed in the textarea of a table. 我有2个注释,这些注释显示在表格的文本区域中。 There are 2 headings associated with the 2 notes. 有2个与2个音符相关的标题。 However i have to make the headings bold and make the second heading fall in the next line. 但是,我必须使标题加粗,并使第二个标题落在下一行中。

<td> 
    <textarea name="txtarea" id="txtid" style="border:none; min-width:200px ; min-height : 250px; "> Organisation Notes : @Model.SendMailList[i].OrgNotes @Html.HiddenFor( m => m.SendMailList[i].OrgNotes )  
                User Notes :   @Model.SendMailList[i].UserNotes @Html.HiddenFor( m => m.SendMailList[i].UserNotes )
          </textarea>                        
    </td>

You cannot use HTML inside TEXTAREA. 您不能在TEXTAREA中使用HTML。

Instead you can emulate it: 相反,您可以模拟它:

 $( document ).ready(function() { $('.editable').each(function(){ this.contentEditable = true; });; }); 
 div.editable { -moz-appearance: textfield-multiline; -webkit-appearance: textarea; border: 1px solid gray; height: 150px; overflow: auto; padding: 2px; resize: both; width: 400px; } .go { font-weight: 700; } 
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> HTML <table width="100%"> <tr><th>HEADER 1</th><th>HEADER 2</th></tr> <tr><td>OTHER TEXT</td><td><div class="editable"><p class="go">Organisation Notes :</p> <p> @Model.SendMailList[i].OrgNotes @Html.HiddenFor( m => m.SendMailList[i].OrgNotes )</p> <p class="go">User Notes :</p><p> @Model.SendMailList[i].UserNotes @Html.HiddenFor( m => m.SendMailList[i].UserNotes )</p> </div></td></tr> </table> 

Regards 问候

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM