Home  >  Article  >  Web Front-end  >  jQuery中:disabled选择器用法实例_jquery

jQuery中:disabled选择器用法实例_jquery

WBOY
WBOYOriginal
2016-05-16 16:22:211348browse

本文实例讲述了jQuery中:disabled选择器用法。分享给大家供大家参考。具体分析如下:

此选择器能够选取所有禁用的表单元素。

语法结构:

复制代码 代码如下:
$(":disabled")

此选择器一般也要和其他选择器配合使用,比如类选择器、元素选择器等等。

复制代码 代码如下:
$("input:disabled").css("background-color","red");

以上代码能够将不可用的input元素的背景色设置为红色。
实例代码:

复制代码 代码如下:






脚本之家





     

  •     不可用文本框:
        可用的文本框:
     





希望本文所述对大家的jQuery程序设计有所帮助。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn