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
I think what you're looking for is
var elm_id = 'my_id';
var elm = $('#' + elm_id);
Selecting by ID in jquery is done with the #
character:
$('#my_id')
I invite you to read the documentation about jQuery Selectors
var elm_id = 'my_id';
var elm = $('#' + elm_id)[0];
Adding the [0] gets the actual node which is what document.getElementById(elm_id); returns.
var elem_id="my_id";
$("#"+elem_id);
You need this (I think):
$('#my_id')
In jquery the following code is being written as:
var elm = $("#my_id");
OR you can write as:
var elm_id = 'my_id';
var elm = $("#" + elm_id);