Drkosh Drkosh - 11 months ago 41
jQuery Question

How to dynamic select element with JQuery by id

I need to dynamic select element with JQuery, I get in code id of element. How to do that ?
I've tried:

var sel='\'#'+id+'\'';
var elem+$(sel);

but it doesn't work ( id is string id of element).

Answer Source

You would use code such as

var ID = 'whatEver';
$('#' + ID).action();

You would then be able to use that to select whatever element you are after.