如何将css类添加到JQuery Mobile Select选项的文本中?

时间:2022-10-31 17:52:03

如何将css类添加到JQuery Mobile Select选项的文本中?

I want to add a span to the text of a JQM select so the result looks like the pic below. I put the code in a html.Raw, but the span tag was removed. The text I tried was :

我想在JQM选择的文本中添加一个范围,所以结果如下图所示。我将代码放在html.Raw中,但是span标记已被删除。我试过的文字是:

@Html.Raw(Every <span class="subtext">(number...)</span>)

1 个解决方案

#1


0  

Maybe you should try it with some quotes. I'm on my phone and can't test it but probably something like this works: 'Every (number...)'

也许你应该尝试一些引用。我在手机上无法测试它,但可能是这样的:'Every(number ...)'

Note that you can't mix up single and double quotes.

请注意,您不能混淆单引号和双引号。

Do you want to add the class to one special element or to all of them?

是否要将类添加到一个特殊元素或所有元素?

To all of them would be like this: $('parentElement li span').addClass ('subtext');

所有这些都是这样的:$('parentElement li span')。addClass('subtext');

#1


0  

Maybe you should try it with some quotes. I'm on my phone and can't test it but probably something like this works: 'Every (number...)'

也许你应该尝试一些引用。我在手机上无法测试它,但可能是这样的:'Every(number ...)'

Note that you can't mix up single and double quotes.

请注意,您不能混淆单引号和双引号。

Do you want to add the class to one special element or to all of them?

是否要将类添加到一个特殊元素或所有元素?

To all of them would be like this: $('parentElement li span').addClass ('subtext');

所有这些都是这样的:$('parentElement li span')。addClass('subtext');