I've been trying to change a text of a td
element however I am not able to make it work:
What could be wrong in that fiddle?
Actually this is just my first step to do my actual goal that is to prettify a date using:
Updated:
Where I need to do:
$(function() {
$('td[kind="date"]').html("Hello?");
})
There are multiple problems
<table
tags p[kind=date]
is invalid since there is no p
element, a td
has the attribute kind="date"
. So
$(function() {
$('td[kind="date"]').html("test");
})
Demo: Fiddle
First,you write the wrong selector,there is not 'p' element,your should try
$("td[kind='date']").html("test");
Second,the quotation marks in selector should be single not double.
Last and most important,your html code missed 'table' tag,so the html will render as text not a table,that's why your selector will not work even you change the selector by other's advices.
Check this Demo ,it works fine.
Can you please refer the below code.
function changeText() {
$("#demoTable td").each(function () {
$(this).html().replace("8: Tap on APN and Enter <B>www</B>", "");
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.