JQuery to remove any div with id on any web page
Usually you need this kind of situation when you are using any framework or templates where header is in different file but being used as common and you need not to show anything specific from that header only on this page, where you can add this:
http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js
<script type=”text/javascript”>
$(“#adTag1″).remove();
</script>
<script type=”text/javascript”>$(“#adTag1″).remove();</script>
YOU CAN ALSO USE ANY OF THESE:
To remove the element with id equal to removeme only if it is empty:
$(“#removeme:empty”).remove();
To remove all empty <div>s:
$(“div:empty”).remove();
EDIT: If it’s not empty, but has whitespace:
if($.trim($(“#removeme”).text()) == “”) {
$(“#removeme”).remove();
}
Posted in Uncategorized
