JQUERY Get Element By parameter ID

后端 未结 6 996
执念已碎
执念已碎 2021-01-20 10:31

just want to know what is the equivalent syntax of this to jquery.

var elm_id = \'my_id\';
var elm = document.getElementById(elm_id);

thank

6条回答
  •  隐瞒了意图╮
    2021-01-20 11:02

    Selecting by ID in jquery is done with the # character:

    $('#my_id')
    

    I invite you to read the documentation about jQuery Selectors

提交回复
热议问题