zoukankan      html  css  js  c++  java
  • jquery禁用a标签

    jquery禁用a标签方法1

    01
    02
    03
    04
    05
    06
    07
    08
    09
    10
    11
    12
    $(document).ready(function () {
            $("a").each(function () {
                var textValue = $(this).html();
                if (textValue == "XX概况" || textValue == "服务导航") {
                    $(this).css("cursor", "default");
                    $(this).attr('href', '#');     //修改<a>的 href属性值为 #  这样状态栏不会显示链接地址 
                    $(this).click(function (event) {
                        event.preventDefault();   // 如果<a>定义了 target="_blank“ 需要这句来阻止打开新页面
                    });
                }
            });
    });

    jquery禁用a标签方法2

    1
    2
    3
    4
    $('a.tooltip').live('click', function(event) {
       alert("抱歉,已停用!"); 
      event.preventDefault();  
    });

    jquery禁用a标签方法3

    1
    2
    3
    4
    $(function(){
    $('.disableCss').removeAttr('href');//去掉a标签中的href属性
    $('.disableCss').removeAttr('onclick');//去掉a标签中的onclick事件
    });

    jquery控制按钮的禁用与启用

    控制按钮为禁用:

    1
    2
    $('#button').attr('disabled',"true");添加disabled属性
    $('#button').removeAttr("disabled"); 移除disabled属性
  • 相关阅读:
    第一课:人人站安装与使用教程
    linux 多个python版本的切换
    参考文章
    windows下scrapy 的安装
    vi 使用入门
    linux 源码安装
    C语言—第二次作业
    C语言第0次作业
    c语言博客园作业03函数
    tomcat对于web.xml的securityconstraint使用的处理机制
  • 原文地址:https://www.cnblogs.com/AnonymouL/p/6836993.html
Copyright © 2011-2022 走看看