Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/298.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
C# 如何使用jquery更改包含父标记的图像src_C#_Jquery_Asp.net_Regex - Fatal编程技术网

C# 如何使用jquery更改包含父标记的图像src

C# 如何使用jquery更改包含父标记的图像src,c#,jquery,asp.net,regex,C#,Jquery,Asp.net,Regex,如何使用jquery更改包含父标记的图像src 您能告诉我如何使用c#检索相同的文件吗 C#代码: string s; s= "<span id=\"span1\"><table><tr><td><img src=\"/image/img01.jpg\"></td></tr>"; I have formatted above code to string and assigned to

如何使用jquery更改包含父标记的图像src

您能告诉我如何使用c#检索相同的文件吗

C#代码:

    string s;

    s= "<span id=\"span1\"><table><tr><td><img src=\"/image/img01.jpg\"></td></tr>";
    I have formatted above code to string and assigned to one label 

    label1.text=s.tostring();
字符串s;
s=“”;
我已将上述代码格式化为字符串并分配给一个标签
label1.text=s.tostring();
现在,我想使用jquery更改imgsrc

我是jquery新手,请任何人帮我解决这个问题。
*注意:我不想对img标记使用id属性。

前提是在范围内只有一个图像(如您的示例):

这应该对你有好处


编辑-2分钟就可以完成

有两个简单的选择,首先使用“andy”给出的代码


$('exampleimg').attr('src','img02.jpg');

label1是显示字符串还是html?你想从字符串中更改吗?你能告诉我如何使用c检索相同的内容吗?你能告诉我如何使用c检索相同的内容吗#
$('#span1 img').attr('src','img02.jpg');
$('#span1 img').attr('src', '/path/to/new/img.jpg');
$('#span1 img').attr('src','img02.jpg');
<img src=\"/image/img01.jpg\" id="exampleimg">

$('#exampleimg').attr('src','img02.jpg');