0

我想做一个存档。当链接被点击时,它应该被禁用,如果再次点击它应该被启用。如何制作这样的链接。

4

2 回答 2

3

你应该看到这个小提琴:http: //jsfiddle.net/FfTmL/3/

HTML:

<input type="button" id="btn" value="Click Me!" />
<br /><br />
<input type="button" id="target" value="ENABLE" />

CSS:

.disabled{
    background:#ccc;
    color: #AAA;
    border: 1px solid #DDD

}

jQuery:

$(function(){
    $("#btn").click(function(){
        if( $("#target").hasClass("disabled") ){
            $("#target").removeClass("disabled");
        }else{
            $("#target").addClass("disabled");
        }
    });
});
于 2013-07-08T06:38:26.073 回答
0

将 id "buttonid" 应用到 ypur 按钮休息将按您的需要工作。

$('#buttonid').on('click', function() {
if ( $(this).hasClass('active') ) {
    // write anything if you want to perform any action when it is active
}
return false;
});

/* CSS 部分 */

#patient { pointer-events: none; }
#patient.active { pointer-events: auto; }

谢谢...

于 2013-07-08T06:33:47.203 回答