i am trying to append 4-5 apces by the below code but it's not working. new to Jquery,JS pls help.
$("#<%= lbl100.ClientID %>").text("Your search request is too broad and the first 100 results are displayed.Please refine your search if your result does not show.").append(" ");
注意:- 我还使用了  
和 adding space
最后(没有用)但是它们按原样打印并且没有空格
最佳答案
使用
与 html()
并确保 id:- <%= lbl100.ClientID %>
正确且存在。
例子:-
$("#abc").html("Your search request is too broad and the first 100 results are displayed.Please refine your search if your result does not show. ").append(" ");
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="abc"></div>
注意:- 如果您尝试选择文本,您会看到空格也被选中。
另一种方法:-
$("#abc").html("Your search request is too broad and the first 100 results are displayed.Please refine your search if your result does not show. see the space");
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="abc"></div>
注意:- 确保在脚本代码之前添加了 jQuery 库,否则它将无法运行,您将得到 $ is undefined
浏览器控制台错误。
关于javascript - 如何在 jquery 中追加 4-5 个空格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44257773/