手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >jQuery针对input的class属性写了多个值情况下的选择方法
jQuery针对input的class属性写了多个值情况下的选择方法
摘要:本文实例讲述了jQuery针对input的class属性写了多个值情况下的选择方法。分享给大家供大家参考,具体如下:jQuery选择inpu...

本文实例讲述了jQuery针对input的class属性写了多个值情况下的选择方法。分享给大家供大家参考,具体如下:

jQuery选择input的class属性写了多个值的情况:

<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script src="jquery-1.6.2.js" type="text/javascript"></script> <style type="text/css"> .content { text-align: left; font-weight: normal; color: #000000; font-size: 9pt; vertical-align: bottom; } .my_sh { } </style> <script type="text/javascript"> function getClassVal(){ jQuery("#1").val(); //只能取到一个id的值 jQuery(".content.my_sh").show(); //可以显示所有input框 } </script> </head> <body> <input type="text" id="1" value="1" /> <input type="text" id="2" value="2" /> <input type="text" id="3" value="3" /> <input type="text" id="4" value="4" /> </body> </html>

【注】:input中的class属性中的多个值之间要有空格,jQuery在取值的时候每个class值之间不能有空格。

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

【jQuery针对input的class属性写了多个值情况下的选择方法】相关文章:

jquery预加载图片的方法

Jquery注册事件实现方法

Jquery中基本选择器用法实例详解

JQuery中基础过滤选择器用法

Nodejs中session的简单使用及通过session实现身份验证的方法

详解AngularJS中$http缓存以及处理多个$http请求的方法

快速判断某个值是否在select中的方法

列表内容的选择

jQuery的Scrollify插件实现滑动到页面下一节点

jQuery取消ajax请求的方法

精品推荐
分类导航