Hello all, I want to remove below element using javascript/jquery.
<p class="classname"><a title="some title" href="#">Hello</a></p>
Please note that i dont have the id of the element so how can i remove it using just the class name.
Thank you.
Hello all, I want to remove below element using javascript/jquery.
<p class="classname"><a title="some title" href="#">Hello</a></p>
Please note that i dont have the id of the element so how can i remove it using just the class name.
Thank you.
you can select items by their class using the following syntax
$(".classname")
So to remove this item it would be
$('.classname').remove();
$('.classname').remove();
// OR
$([container selector]).remove('.classname');
according to the jQuery documentation.
If the link is unique but the paragraph with the classname is not and you only want to remove this single element, search for the link first:
$("a:contains('Hello')").parent().remove();