Hide a <div> with jQuery without using ID or class

I want to hide the following <div> in my site pages, but this <div> is changing its position dynamically, so I cannot use the code $("div:eq(0)").hide();

<div style="background: #ebebeb; border-top: 1px solid #ccc; border-right: 1px solid #ccc;
border-left: 1px solid #ccc; padding: 5px; font-size: 12px; position: fixed; right: 3%; 
bottom: 0px; -webkit-border-radius: 3px 3px 0px 0px; border-radius: 3px 3px 0px 0px;">
Powered by <a href="http://bizmate.in">Bizmate</a></div>

Any suggestions on how can I hide that element?

Related posts

Leave a Reply

6 comments

  1. Firstly, you really should not put all of those styles inline. It clutters your html, and is poor design since you are mixing styling and layout. It would be better to take it out, use css selectors and wrap it in <style></style> tags; to that end you should also add a class to the <div> to make these selections easier to carry out and more maintainable.

    That being said, the following function using .filter() will do what you want…

    $("div").filter( function() { 
        return $(this).find("a[href^='http://bizmate.in']").length > 0;
    }).hide();
    
  2. try

    $("a[href='http://bizmate.in']",  $("#container")).closest('div').hide();
    

    Assume in the parent elements of given html, you can find one with id=”container”, this will ensure the right is found with that container rather than else where since a link like that is pretty common.