[jQuery] JQuery variable usage with single/double quote problem
Can anyone help on this one? .........
The following statement is proven to work:
p_viewSelector=$("select[name='dllViewSelector_Search_0']
option:selected").text();
But now I need to adapt it so the Search_0 component is replaced by a
variable (because it isn't always going to be Search_0 at that point.
So I've got
curSelector="ddlViewSelector"+idCurrent;
p_viewSelector=$("select[name='"+curSelector+"']
option:selected").text();// single quote just before the 1st + and
just after the 2nd +
//idCurrent might be Search_0, but
could be Search_<any integer>
(and also tried lots of other combinations e.g.
curSelector="'ddlViewSelector'"+idCurrent;// dbl quote sing
quote ....sing quote dble quote
p_viewSelector=$("select[name="+curSelector+"]
option:selected").text();
)
So, if anyone is expert with jquery variables, quotes, string
contenation etc. who can solve this one, it would be greatly
appreciated!