我想要删除自定义td的值。
<td> <input type="hidden" name="myinput" value="1"> some text </td>
我不想删除输入,只想删除一些文本。有什么帮助?
答案 0 :(得分:1)
然后只调用textContent
方法
text
例如,
//$("td").text(""); //Doesn't work
//$("td")[0].textContent = ""; //Doesn't work
//convert childNodes to Array and then iterate through the same
Array.prototype.slice.call( $("td")[0].childNodes ).forEach(function(node){
node.nodeType == 3 && node.parentNode.removeChild(node); //if the node is a text node then remove the same
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table>
<tr>
<td>
<input type="hidden" name="myinput" value="1">some text</td>
</tr>
</table>
答案 1 :(得分:0)
香草溶液
<table>
<td> <input type="text" name="myinput" value="1"> some text </td>
</table>
&#13;
{
... // your JSON properties here
"serviceProperties": { // properties for service
"ServiceEndpoint": "https://somedomain:1200/web/Servlet/SOAP/Services",
"Certificates": false,
"DocumentName": "note.pdf"
}
}
&#13;