1

I have a variable that has this string:

<DIV><SPAN style="FONT-FAMILY: Tahoma; FONT-SIZE: 10pt">[If the confirmation is active the subscriber will receive this email after succesfully confirming. If not, this will be the first and only email he will receive.]</SPAN></DIV>
<p align=center>
    <input class=fieldbox10 type = 'button' name = 'button' value = 'Close' onclick = "window.close()">
</p>

How do I remove the below string without worrying about spaces via Javascript (or jQuery)?

<p align=center>
    <input class=fieldbox10 type = 'button' name = 'button' value = 'Close' onclick = "window.close()">
</p>

2 Answers 2

4

Maybe this?

$(html).remove('p');
Sign up to request clarification or add additional context in comments.

1 Comment

I may have more HTML appended before and after. Is there a way to zero in on that specific paragraph? I just want to get rid of the close button. Any way to do it by the onclick = "window.close()"?
2

If your var was myString you can do this:

var temp = $("<div />").append(myString);
temp.find('p:has(input[value=Close])').remove('p');
myString = temp.html();​

You can see a working demo here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.