jquery table replace partial table content inside html -


i have table:

html

<div class="bbclass1 bbclass2">     <table>         <tr>             <td><b>name:</b> value1</td>             <td>value2</td>             <td>value3</td>             <td>value4</td>         </tr>     </table> <div> 

i need replace 'name:' to 'hello:'

how do this?

i have tried

$("td :contains('name:')").text("hello:");  

for reason replaces entire table name1.

this not work either:

$("div:contains('name:')").html("hello"); 

any other suggestions?

you using wrong selector.

there should no space between

`"td :contains"`     ^------- remove space 

supposed

$("td:contains('name:')").text("hello:");  

you can try

$("td b:contains('name:')").text("hello:");  

check fiddle


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -