3

I'm trying to append to this code:

<table class="stores" border="1" cellspacing="10"> <tr>Stores:</tr> </table> 

This code, which I want to work, doesn't:

$('.stores').append('<tr>Test</tr>'); 

This one does work:

$('.stores').append('<p>Test</p>'); 

Can you say why?

P.S. Not sure it matters but I'm working under WordPress.

2 Answers 2

6

You can't have text between tr-tags. Try this:

$('.stores').append('<tr><td>Test</td></tr>'); 
Sign up to request clarification or add additional context in comments.

Comments

5

That's not valid HTML. You're missing the <td>

Works fine when you change the markup : http://jsfiddle.net/jomanlk/XHvVk/

$('.stores').append('<tr><td>Test</td></tr>'); 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.