0

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>
3
Contributors
3
Replies
25
Views
3 Years
Discussion Span
Last Post by Troy III
0
$(".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!

Edited by Luckychap

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.