如何访问按钮文本中的第一个单词

How to access the first word in a button text

这是我的代码

<button class="mcnTextContent"  type="button" style="text-decoration:underline">Click here to Reactivate your account before Feb. 1, 2016 for FREE</button>

我想让第一个词 (Click) 只带下划线。谁能帮我弄清楚。

谢谢

您可以像这样 span 将单词 Click 包装在样式中

<button class="mcnTextContent"  type="button"><span style="text-decoration:underline">Click</span> here to Reactivate your account before Feb. 1, 2016 for FREE</button>

Original Fiddle

我还建议不要使用内联样式,所以这里没有内联css

CSS

#underline{
    text-decoration:underline;
}

HTML

<button class="mcnTextContent"  type="button">
    <span id="underline">Click</span> here to Reactivate your account beforeFeb. 1, 2016 for FREE
</button>

Updated Fiddle

<button class="mcnTextContent"  type="button" >
    <span style="text-decoration:underline;">Click</span> here to Reactivate your account before Feb. 1, 2016 for FREE
</button>