zoukankan      html  css  js  c++  java
  • jquery 点击当前input元素对象获取下一个input对象

       

    • <div class="apps_container">  
    •    
    •         <input type="hidden" value="00070008"  onclick="more(this);" />  
    •         <input type="hidden" value="100000001811" id="columId" />  
    •      
    • </div>  
    • <script>  
    •  function more(thisObj ){      
    •      var levelCode=$(thisObj).parent().next().children("ul").children("input").eq(0).val();      
    •      var menuI = $("#menuI").val();  
    •      var newInfo = $(thisObj).parent().prev().children("input").eq(0).val();  
    •       if(newInfo && newInfo=='1'){  
    •           menuI=1;   
    •       }  
    •      var columId=$(thisObj).parent().next().children("ul").children("input").eq(1).val();  
    •      url="/12580SchoolWap/article/getCmsModuleList.do?levelCode="+levelCode+"&columnID="+ columId+"&menuI="+menuI;  
    •     document.location=url;  
    • }  
    • </script>  
    • 当点击 <href="#" style="cursor: hand" onclick="more(this);" class="fright mr15">更多</a>时,  
    • 在js的函数中想要获取隐藏域的值  
    • <input type="hidden" value="00070008" id="levelCode" />  
    • <input type="hidden" value="100000001811" id="columId" />  
    •   
    • onclick="more(this);"这里的this 指的是当前dom元素  <a></a>标签  
    •   
    • 在js的函数function more(thisObj){...}中,  
    • 1.$(thisObj)获取<a></a>的jquery对象,  
    • 2.$(thisObj).parent(),获取到<a></a>的父对象<div class="sx_title">...</div>  
    • 3.$(thisObj).parent().next() 获取到<div class="apps_container">jquery对象  
    • 4.$(thisObj).parent().next().children("ul") 获取到<ul class="apps_list1_1">jquery对象  
    • 5.$(thisObj).parent().next().children("ul").children("input").eq(0)  
    • 获取到<ul class="apps_list1_1">下面的第一个<input>元素:<input type="hidden" value="00070008" id="levelCode" />  
    • 6.$(thisObj).parent().next().children("ul").children("input").eq(0).val();  
    • 获取到<input type="hidden" value="00070008" id="levelCode" />的value值 :00070008  
    • 7.$(thisObj).parent().next().children("ul").children("input").eq(1).val();  
    • 获取到<ul class="apps_list1_1">下面的第二个<input>元素,  
    • <input type="hidden" value="100000001811" id="columId" />的值:100000001811  
    • 8.$(thisObj).parent().prev()获取到<span></span>jquery对象  
    • 9.$(thisObj).parent().prev().html()获取到<span></span>的内容<input type="hidden" value="1" id="newInfo"></input>  
    • 10.$(thisObj).parent().prev().children("input").eq(0).val()获取  
    • <span></span>下面的第一个<input>的值,其实就一个<input>元素,即:1  
  • 相关阅读:
    geoserver发布地图服务WMTS
    geoserver发布地图服务WMS
    geoserver安装部署步骤
    arcgis api 3.x for js 入门开发系列十四最近设施点路径分析(附源码下载)
    arcgis api 3.x for js 入门开发系列十三地图最短路径分析(附源码下载)
    cesium 之自定义气泡窗口 infoWindow 后续优化篇(附源码下载)
    arcgis api 3.x for js 入门开发系列十二地图打印GP服务(附源码下载)
    arcgis api 3.x for js 入门开发系列十一地图统计图(附源码下载)
    arcgis api 3.x for js 入门开发系列十叠加 SHP 图层(附源码下载)
    arcgis api 3.x for js入门开发系列九热力图效果(附源码下载)
  • 原文地址:https://www.cnblogs.com/Strugglehard/p/6672782.html
Copyright © 2011-2022 走看看