id property returns null or undefined

This question already has an answer here:

  • How can I get the ID of an element using jQuery? 17 answers

  • 尝试这个:

    var columnID = $(this).closest(".col-md-4.column").attr('id');
    

    There is no id property. Use .attr('id') .


    Try

    $(this).closest(".col-md-4.column").attr('id')
    

    The attributes have to be accessed with the .attr method

    链接地址: http://www.djcxy.com/p/83296.html

    上一篇: 获取元素ID

    下一篇: id属性返回null或未定义