Javascript 如何使用jquery使文本加粗
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7547643/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to make the text bold using jquery
提问by user957178
I have this out put.
我有这个。
<option value="18277">Dollar Max Hospice~Mx</option>
<option value="12979">Routine Adult Physical Exam Visit Limit</option>
<option value="12841">Is Reverse Sterilization Covered Out of Network?</option>
<option value="12918">MD CDH PPO Variables 2</option>
<option value="12917">DC CDH PPO Variables 2</option>
<option value="12833">Is Sterilization Covered No Network?</option>
<option value="12834">Is Sterilization Covered In Network</option>
I have a search box and button when i hit Dollar I need to bold the text in my list box. I need to itterate the list box data and make that text as bold.
当我点击 Dollar 时,我有一个搜索框和按钮,我需要将列表框中的文本加粗。我需要对列表框数据进行迭代并将该文本设为粗体。
回答by Freesn?w
Using the jQuery, you can apply the css:
使用 jQuery,您可以应用 css:
font-weight:Bold;
So just do:
所以只需这样做:
$myElement.css("font-weight","Bold");
回答by Bojangles
For me on FF6 at least, it will show as a normal font in the select box, however in the actual list itself it will show bold if you do:
至少对我来说,在 FF6 上,它会在选择框中显示为普通字体,但是在实际列表中,如果您这样做,它将显示为粗体:
$('select option[value="18277"]').css({ 'font-weight': 'bold' });
回答by Niet the Dark Absol
You can't bold an individual <option>
in a <select>
control. It's annoying, but that's how it is.
您不能<option>
将<select>
控件中的某个人加粗。这很烦人,但就是这样。