There are 2 radiobutton and a hyperlink. if select radiobutton1 the hyperlink is enabled. if select radiobutton2 the hyperlink is disabled. i can use jquery to disable the hyperlink, but can t enable it. How to enable the hyperlink with jquery?
如何启用超链接?
原标题:
问题回答
你可以尝试添加点击事件处理程序,并根据单选按钮的状态从点击处理程序返回 true 或 false。
返回false应该取消链接的点击,类似于:
$("#hyperlink1").click(function(){
// return true or false based on your radio buttons
return enableLink;
});
要停用超链接,您可以为其添加一个返回false的onclick处理程序;
像这样的东西:
$("#radioDisable").click(function() {
$(“hyperlink”).click(function(){
return false;
});
$(“hyperlink”).addClass(“disabled”);
});
$("#radioEnable").click(function() {
$(“hyperlink”).click(function(){
return true;
});
$(“hyperlink”).removeClass(“disabled”);
});
禁用属性可以被获取和设置。但是,此属性仅适用于单个对象,而不适用于对象集合。
if (!$("#ContinueButton")[0].disabled) {
UserContinue();
}
写
$("#ContinueButton")[0].disabled = !canContinue;
相关问题
热门标签
- winforms
- combobox
- fogbugz
- java
- date
- internationalization
- asp.net
- iis
- url-rewriting
- urlrewriter
- c#
- enums
- ocaml
- haxe
- algorithm
- string
- viewstate
- .net
- c++
- c
- symbol-table
- mysql
- database
- postgresql
- licensing
- migration
- vb.net
- vb6
- declaration
- vb6-migration
- python
- psycopg2
- backup
- vmware
- virtualization
- gnu-screen
- authentication
- desktop
- excel
- xll
- cultureinfo
- regioninfo
- oracle
- client
- session
- download
- html
- virtual
- constructor
- scenarios
- perl
- full-text-search
- javascript
- ajax
- testing
- oop
- inheritance
- vim
- encapsulation
- information-hiding