I have some images created with php and i want to put each of them inside a li. Here is my working code :
for ( i = 0; i < MaxNum; i++) {
$('li#' + i + '').html('<img src="http://www.address.com/somephp.php?Num=1" />')
}
All i want to do now is put the i variable in the the image source in order to have something like this:
for ( i = 0; i < MaxNum; i++) {
$('li#' + i + '').html('<img src="http://www.address.com/somephp.php?Num="+i />')
This code is not working. Is it possible to that with this way?
Problem to you code
'<img src="http://www.address.com/somephp.php?Num="+i />'in this codeiis treated as String, not a variable.Not a problem but better
to remove
+ ''part from$('li#' + i + '').