songpa7 (4) [Avatar] Offline
#1
<body><h5>Hello</h5>
<p>Nice to see you.</p>
<h5>Good Bye</h5><body>

I want to change the above html codes as follows using jquery,

<body><table><tr><td><h5>Hi</h5></table>
<p>Nice to see you</p>
<h5>See you </h5></body>

How can I do that?
Sorry, I'm not a professional...

Message was edited by:
songpa7
bear.bibeault (675) [Avatar] Offline
#2
Re: beginner's question
Well, your example HTML is invalid, so jQuery's not gonna let you create that exactly. smilie

But read the chapter on DOM manipulation (chapter 3). It's easy to insert new element types, for example:

$('<table></table>').before(someElement);

and it's easy to change the content of an element:

$('h5').html('Something else');
songpa7 (4) [Avatar] Offline
#3
Thank you for your kindness
Thank you for your kindness.

I'll probably work harder with chapter3.
bear.bibeault (675) [Avatar] Offline
#4
Re: Thank you for your kindness
Give it a try and post your code.