Jquery elements always block

Total Post:41

 1504  View(s)
Rate this:
Hi Guys

I have created Safari Extension that blocks certain elements from Facebook and I was wondering is it possible to make it block all the time. For example, it blocks the elements when you load Facebook, however when you click the Facebook logo in the top left corner all the elements come back, you have to manually reload the page to block them again. So basically all the elements come back when you click something that doesn't reload the page.Please help me

Here is my code.

jQuery(document).ready(function () {
      $("#content").find("#sideNav").find("#listsNav").css("display", "none");

  1. Post:51

    Re: Jquery elements always block

    It all depends on what facebook actually does when you click the logo.

    If it makes an AJAX request, then you can listen for that event and re-hide the elements then.

    For example:

    $(document).ajaxComplete(function () {
        $("#content").find("#sideNav").find("#listsNav").css("display", "none");

    If it just runs some local javascript then you could listen for the click event, and again run your code. For example, assuming the logo has an id of #logo

    $("#logo").click(function () {
        $("#content").find("#sideNav").find("#listsNav").css("display", "none");

    In addition, as suggested by Satpal, ids are meant to be unique to a page so you don't need to find them the hard way, just reference them directly like so:


      Modified On Apr-06-2018 01:53:09 AM