zoukankan      html  css  js  c++  java
  • form 中的 table元素过滤定位事件

    <form>
        <table>
              <thead>
                  <tr>
    	             <th>a</th>
    	             <th>b</th>
    	             <th>c</th>
    	             <th>d</th>
    	             <th>e</th>
                   </tr>
              </thead>
              <tbody>
                   <tr class='row'>
                        <td><input type='text' name='1' id='1' ></td>
                        <td><select name='o1' id='o1'><option></option></select></td>
    	            <td><input type='text' name='2' id='2' ></td>
    	            <td><input type='text' name='3' id='3' ></td>
                        <td><select name='o12' id='o12'><option></option></select></td>
                   </tr>
              </tbody>
        </table>
    </form>        
    

     利用filter过滤选择器对元素集合进行遍历,index表示索引号,obj表示对象,obj.value表示的是获取的值。通过判断获取的值是否为空来给对象的样式进行修改:

    $('.row').find('input','select').filter('[name$=opc_width],[name$=opc_space],[name$=bias]').each(function(index,obj){
             if(obj.value == '' || obj.value == null || obj.value == "undefined"){
                      $(obj).css('border-color','red');
             }else{
                      $(obj).css('border-color','');
            }
    });

  • 相关阅读:
    CMD命令提示符的基本操作指令
    JDBC连接Oracle
    JDBC连接MySQL
    Oracle树状结构的存储与展示
    C语言 深入学习
    C# widget
    C#深入多线程
    数据库常用知识
    ASP.NET开发总结
    ASP.NET —— Web Pages
  • 原文地址:https://www.cnblogs.com/christal-11/p/8119366.html
Copyright © 2011-2022 走看看