I am using ASP.NET to create a page with a GridView and Image , this code show in Image GridView's first row picture, how can I get next row source?
$('#Image1').src = $('#grdImages td img').src;
I am using ASP.NET to create a page with a GridView and Image , this code show in Image GridView's first row picture, how can I get next row source?
$('#Image1').src = $('#grdImages td img').src;
Also this syntax is wrong as a jQuery
object has no method called src
.. A DOM
object does..
Try this instead
$('#grdImages td img')[0].src;
// Plain javascript
$('#grdImages td img').attr('src');
// jQuery
If you are in the context of an event try this
$(this).closest('tr').next('tr').find('img').attr('src')
You can always select the row using eq
selector
$('#grdImages).find('tr:eq(1) img').attr('src');
Selects the second row.