The following A HREF element modified through the jquery deletes the nested IMG element .
<table id="newHead" width="90%" align="center" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC" style="display: none;border: 1px #000066 groove;">
<tr height="25px">
<td style="text-align: center;padding-left: 10px;"><strong style="white-space: nowrap; font-size: 12px; ">
<font color="#000066"> Rep开发者_如何学Goort</font></strong></td>
<td> <a id="url" href="mmRep.do?action=getXLSummReport&reportId="><img align="right" hspace="850px" src="images/graph_bar/graph_Excel.jpg" width="25" height="25" border="0"> </a></td>
</tr>
</table>
This jquery removes the nested IMG element( )
var newurl = $("a#url").attr("href") + reportId;
$("a#url").attr("href",newurl);
After i modify the href attr value, the html becomes likes this, the img element vanishes
<td>
<a id="url" href="mmRep.do?action=getXLSummReport&reportId=75">
</a>
</td>
Nope, it doesn't.
Make sure your reportId
contains an integer, and nothing else, like quote "
or a single quote '
.
精彩评论