Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在java脚本中仅获取图像的src值_Javascript_Jquery_Jqgrid_Free Jqgrid - Fatal编程技术网

Javascript 如何在java脚本中仅获取图像的src值

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&amp;id=409" height="70" width="90" class="example1tooltip" style="cursor:pointer" alt="photo"

我在图像标签中有这个值

我正在使用jqgrid,当我调用

$('#testGridList').jqGrid ('getCell', id, 'pic');
本报税表

<img src="http://localhost:8080/myApp/DownloadFile?type=THU_IMG&amp;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..很乐意帮助您..;)