我有一个实例,我想根据点击更改文本和选择框的状态.
$("#foo").click(function(){
$("#mytext").toggle();
$(this).text($(this.text() == 'on' ? 'off' : 'on');
// here i also want to enable and disable a select box, not sure how to do this other then checking if the value of (this).text is on or off.
});
Run Code Online (Sandbox Code Playgroud)
非常感谢!
var status = $(this).text();
$('#dropdownId').prop('disabled',status != 'on');
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3064 次 |
| 最近记录: |