源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

jQuery针对input的class属性写了多个值情况下的选择方法

  • 时间:2022-11-11 02:34 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:jQuery针对input的class属性写了多个值情况下的选择方法
本文实例讲述了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" class="content my_sh" value="1" />
  <input type="text" id="2" class="content my_sh" value="2" />
  <input type="text" id="3" class="content my_sh" value="3" />
  <input type="text" id="4" class="content my_sh" value="4" />
 </body>
</html>

[b]【注】:input中的class属性中的多个值之间要有空格,jQuery在取值的时候每个class值之间不能有空格。[/b] 更多关于jQuery相关内容感兴趣的读者可查看本站专题:《[url=http://www.1sucai.cn/Special/75.htm]jquery选择器用法总结[/url]》、《[url=http://www.1sucai.cn/Special/93.htm]jquery中Ajax用法总结[/url]》、《[url=http://www.1sucai.cn/Special/539.htm]jQuery表格(table)操作技巧汇总[/url]》、《[url=http://www.1sucai.cn/Special/497.htm]jQuery拖拽特效与技巧总结[/url]》、《[url=http://www.1sucai.cn/Special/451.htm]jQuery扩展技巧总结[/url]》、《[url=http://www.1sucai.cn/Special/430.htm]jQuery常见经典特效汇总[/url]》、《[url=http://www.1sucai.cn/Special/104.htm]jQuery动画与特效用法总结[/url]》及《[url=http://www.1sucai.cn/Special/200.htm]jQuery常用插件及用法总结[/url]》 希望本文所述对大家jQuery程序设计有所帮助。
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部