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

这篇文章主要介绍了jQuery针对input的class属性写了多个值情况下的选择方法,结合实例形式对比分析了jQuery选择器针对class属性中有多个值情况下的选中方法,需要的朋友可以参考下

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

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

<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script src="https://www.jb51.net/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" value="1" /> <input type="text" value="2" /> <input type="text" value="3" /> <input type="text" value="4" /> </body> </html>

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

更多关于jQuery相关内容感兴趣的读者可查看本站专题:《jquery选择器用法总结》、《jquery中Ajax用法总结》、《jQuery表格(table)操作技巧汇总》、《jQuery拖拽特效与技巧总结》、《jQuery扩展技巧总结》、《jQuery常见经典特效汇总》、《jQuery动画与特效用法总结》及《jQuery常用插件及用法总结

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

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wzpygd.html