javascript - How is it possible to run a jQuery function with an variable instead of an id? -


how possible run jquery function this:

$('#do here variable').trigger('click'); 

with variable contains id string like: var demoid = "idx";

so how should correct syntax been written?

a try of me this:

function doitlikeaclick(){ var demoid = "idx"; $(demoid).trigger('click');} 

but not work. javascript stopp.

yes

$('#' + demoid).trigger('click'); 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -