[Solved] Difference between $(‘#id’) and $(“#’+”id”+'”)

[ad_1]

// JQuery evaluation of a selector
var DA_input1 = $('#id1');
// Simple string
var DA_input2 = '@$("#' + "id1" + '")';

if you would like to specify the id in a variable and make JQuery evaluate the string in the variable, you could do:

var selector="#id1";
var $input  = $(selector);

Please note i named the variable selector, since it can be any css selector,
e.g:

var selector=".classNameHere";

which would select all elements which have the class classNameHere

[ad_2]

solved Difference between $(‘#id’) and $(“#’+”id”+'”)