Javascript 如何在java脚本中仅获取图像的src值
我在图像标签中有这个值 我正在使用jqgrid,当我调用Javascript 如何在java脚本中仅获取图像的src值,javascript,jquery,jqgrid,free-jqgrid,Javascript,Jquery,Jqgrid,Free Jqgrid,我在图像标签中有这个值 我正在使用jqgrid,当我调用 $('#testGridList').jqGrid ('getCell', id, 'pic'); 本报税表 <img src="http://localhost:8080/myApp/DownloadFile?type=THU_IMG&id=409" height="70" width="90" class="example1tooltip" style="cursor:pointer" alt="photo"
$('#testGridList').jqGrid ('getCell', id, 'pic');
本报税表
<img src="http://localhost:8080/myApp/DownloadFile?type=THU_IMG&id=409" height="70" width="90" class="example1tooltip" style="cursor:pointer" alt="photo" title="View Org photo" onclick="getUxx()">
如何仅获取
src
值?您可以像下面这样获取src值
var src = $('#testGridList').jqGrid ('getCell', id, 'pic').src;
尝试使用attr()
,如图所示:-
var gridcell = $('#testGridList').jqGrid ('getCell', id, 'pic');
var imgsrc = $(gridcell).attr("src");
.getAttribute(“src”)不工作。“未捕获的TypeError:$(…).jqGrid(…).getAttribute不是函数”@iTech..很乐意帮助您..;)