jQuery Find and List all LI elements within a UL within a specific DIV

后端 未结 4 1472
终归单人心
终归单人心 2020-12-09 02:49

I have 3 Columns of ULs each a Dynamic UL container that can have anywhere from 0-9 LI containers (eventually more). All my LI elements have an attribute \"rel\" which I am

4条回答
  •  遥遥无期
    2020-12-09 03:11

    html

    • info1
    • info2
    • info3

    Get index,text,value js

        $('#oneAnswer li').each(function (i) {
    
            var index = $(this).index();
            var text = $(this).text();
            var value = $(this).attr('value');
            alert('Index is: ' + index + ' and text is ' + text + ' and Value ' + value);
        });
    

提交回复
热议问题