如何在禁用所有href时仅启用特定的href?

时间:2014-05-28 10:05:44

标签: javascript jquery html

我正在努力禁用用户状态= 2的特定网页中的所有链接。但由于设计原因。我使用href传递值而不是按钮。所以,我现在想要的是想要启用特定的href。

这是我的JavaScript:

$(function(){
    if(<{$status}> === 2){
        $("a").on("click", function(){
            var e = window.alert("Please fill in your details.");

            if(e == true)$("input[name=name]").focus();
            else $("input[name=name]").focus();
        return false;
        }); 
        //this is what I tried
        $("#save").off("click");
    }
})

这是我要启用的HTML href:

<div class="button">
 <input type="submit" name="submit" onclick="xajax_editprofile(xajax.getFormValues('updateuser')); return false;" style="width:1px; visibility:hidden;">
<a href="#" id="save" onclick="xajax_editprofile(xajax.getFormValues('updateuser')); return false;">Save</a></div>
</div>

希望有人可以帮助我。谢谢你提前。

0 个答案:

没有答案