亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

javascript - Use the on method to bind ui, the following li event, ui, li are generated by ajax, novice please help
漂亮男人
漂亮男人 2017-06-12 09:19:56
0
3
770

Use on, but it cannot be bound, and I have doubts.

on method

/*選擇車輛品牌*/
    $("#assessBrand").on('click',ul, function() {
        //想獲取值,發(fā)現(xiàn)沒(méi)綁定到,
        var tel =$(this).text();
         var rid =$(this).attr("tagnum");
         alert(tel);
         alert(rid);
         $("#taginput").attr("tagnum",rid);
        $("#taginput").attr("placeholder",tel);
        
    });

tag, since it is generated by ajax method without actual code, I used pictures

pThe following tags are all generated by ajax. I would like to ask how to bind events

漂亮男人
漂亮男人

reply all(3)
扔個(gè)三星炸死你

Did I write it wrong? Such as:

$("#assessBrand").on('click', 'li', function() {
    // 略
});

Test: https://jsfiddle.net/4oyboawr/1/

小葫蘆

Are you sure the on method is not written incorrectly? ? I don’t know how long I haven’t used jq, but my impression is that it is bound like this $(document).on(event, selector, callback)

三叔

Do you want to bind events to li below ul? You can use on directly

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template