最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

jQuery节点的查询_html/css

来源:动视网 责编:小采 时间:2020-11-27 16:40:18
文档

jQuery节点的查询_html/css

jQuery节点的查询_html/css_WEB-ITnose:XXxxxxxxxxXXxxxxxxxxXXxxxxxxxx ------------------------jQuery代码如上面 回复讨论(解决方案) 如上所示 点击某一个标签 怎么获得上面就近的 a 的id $(li).click(function(event){ alert($(th
推荐度:
导读jQuery节点的查询_html/css_WEB-ITnose:XXxxxxxxxxXXxxxxxxxxXXxxxxxxxx ------------------------jQuery代码如上面 回复讨论(解决方案) 如上所示 点击某一个标签 怎么获得上面就近的 a 的id $(li).click(function(event){ alert($(th


XX
  • xx
  • xx
  • xx
  • xx
  • XX
  • xx
  • xx
  • xx
  • xx
  • XX
  • xx
  • xx
  • xx
  • xx

  • ------------------------jQuery代码如上面


    回复讨论(解决方案)

    如上所示 点击某一个

  • 标签 怎么获得上面就近的 a 的id

    $("li").click(function(event){	alert($(this).parent().prev().attr("id"));});

    $("li").click(function(event){	alert($(this).parent().prev().attr("id"));});

    不行,这个方法 没有得到


    $("li").click(function(event){	alert($(this).parent().prev().attr("id"));});

    不行,这个方法 没有得到



     test XX
  • xx
  • xx
  • xx
  • xx
  • XX
  • xx
  • xx
  • xx
  • xx
  • XX
  • xx
  • xx
  • xx
  • xx

  • 引入jquery,并且你的dom结构写正确

    $("li").click(function(event){ alert($(this).parents("a").attr("id"));});

    这样呢?

    引入jar包,js区域写上
    $(function(){
    $("li").click(function(event){
    alert($(this).parent().prev().attr("id"));
    });
    })

     

    引入jar包,js区域写上$(function(){ $("li").click(function(event){ alert($(this).parent().prev().attr("id")); });})

    也不可以。无法获取

    我贴部分源码。

    XX

  • xx
  • xx
  • xx
  • xx
  • XX

  • xx
  • xx
  • xx
  • xx
  • XX

  • xx
  • xx
  • xx
  • xx
  • $.ajax({xxxxxxsuccess:function(){ $("ul li:last-child").bind("click", Addhut);}}); function Addhut() { // parId = $(this).parent().filter("a").attr("id"); parId = $(this).parent("a").prev().attr("id"); alert(parId);}

    具体结构就是这样,页面载入时执行ajax函数,成功后执行回调函数。最后一个li标签绑定Addhut函数 点击后 获得上面的的id

    跪求大神答疑解惑!



    你检查你的事件,我们给你的基本都可以



    你检查你的事件,我们给你的基本都可以


    为什么我的 一直提示 undefined



    你检查你的事件,我们给你的基本都可以


    ---------------------------绑定函数的一样可以吗------------------------------------



    你的bind的格式不对,这是点击每项的最后一个弹出提示



    你的bind的格式不对,这是点击每项的最后一个弹出提示


    嗯啊 搞定了 3Q

    不客气,不懂的可以多百度,查api,问别人是最后的手段

    不客气,不懂的可以多百度,查api,问别人是最后的手段


    ----------------------------------------------------------------------
    是啊,基本上有提供个思路或者方向,比自己盲目的乱找快多了,还是谢谢你们!

  • 文档

    jQuery节点的查询_html/css

    jQuery节点的查询_html/css_WEB-ITnose:XXxxxxxxxxXXxxxxxxxxXXxxxxxxxx ------------------------jQuery代码如上面 回复讨论(解决方案) 如上所示 点击某一个标签 怎么获得上面就近的 a 的id $(li).click(function(event){ alert($(th
    推荐度:
    标签: 查询 html css
    • 热门焦点

    最新推荐

    猜你喜欢

    热门推荐

    专题
    Top