showing results for - "jquery add number as id variable"
Dior
12 Mar 2018
1You need to add parenthesis () for priority to evaluate add loopVar first. If your variable contains numeric value then do not need to apply parseInt function.
2
3loopVar = "1";
4alert('#imgAvatar'+(parseInt(loopVar)+1));
5
6OR
7
8loopVar = 1;
9alert('#imgAvatar'+ (loopVar+1) );