【发布时间】:2014-11-07 20:02:23
【问题描述】:
我正在尝试使用三元运算符来切换按钮文本,但它不起作用。
<button type="button" id="ter" >Bar</button>
$("#ter").click(function(){
$(this).text() = 'Bar' ? 'column':'Bar';
});
这样可以吗?我做错了什么?我知道还有很多其他方法可以实现这一点,但我只需要知道这种方法是否可行?
【问题讨论】:
标签: javascript jquery conditional-operator