I'm a bit new to DOM [please bare with me] and what I want remove some html as I don't actually have access to the HTML file. This is because it is a CMS so would it be possible to manipulate code via DOM?

Here is a code sample I have just written, how do I remove the frmMain [first form tag] but keep second from tag via DOM?

I know you cannot nest a <form> within a <form>.

<form id="frmMain" >

<form class="second-form"></form> 

</form>
$(".second-form").clone().prependTo("#frmMain");
$("#frmMain").remove();

Use jQuery to make your life easy!

First clone the inner form and add it above the outer form. Them remove the outer form.

Thanks!

thanks Luckychap but it didn't work for me.

I know you cannot nest a <form> within a <form>.

Than, can you please provide us with the original source code fragment instead?
Because, (since you already know that) you cannot nest a form within a form:

The form with className: second-form will not be parsed;
Therefore - will not beavailable to the DOM API,
that is: will not exist!

Since there is no nested form parsed in the document, there's nothing you can do to or with it.

So if there is no other code but this in your source, we can call this a final answer. Nothing left to add to it.

Regards.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.