Reputation: 35276
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?");
})
Upvotes: 0
Views: 182
Reputation: 1210
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.
Upvotes: 1
Reputation: 7375
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>", "");
}
}
Replace text inside td using jQuery
Upvotes: 0
Reputation: 388316
There are multiple problems
<table
tagsp[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
Upvotes: 4