Getting element id with jquery

前端 未结 4 799
庸人自扰
庸人自扰 2021-01-27 15:24

The code should print the id of the selected div but it does not. I did not find the error. Thanks for help.

HTML


   
4条回答
  •  隐瞒了意图╮
    2021-01-27 15:47

    To access id use 'on' as your div is dynamically generated:

    $(document).ready(function() {
       $('#form_area').on('click', '.form_row', function () {
            console.log(this.id);
        });
    });
    

提交回复
热议问题