לאתר זה תהיה פונקציונליות מוגבלת בזמן שאנו מתחזקים אותו לשיפור החוויה שלך. אם מאמר מסויים לא פותר את הבעיה שלך וברצונך לשאול שאלה, קהילת התמיכה שלנו מחכה לעזור לך ב־Twitter תחת ‎@FirefoxSupport וב־Reddit תחת ‎/r/firefox.

חיפוש בתמיכה

יש להימנע מהונאות תמיכה. לעולם לא נבקש ממך להתקשר או לשלוח הודעת טקסט למספר טלפון או לשתף מידע אישי. נא לדווח על כל פעילות חשודה באמצעות באפשרות ״דיווח על שימוש לרעה״.

מידע נוסף

Can't Hide elements without/with jQuery

  • 6 תגובות
  • 2 have this problem
  • 1 view
  • תגובה אחרונה מאת cor-el

more options

I've created new Addon for my Firefox that I will use myself, but can't get it hide elements with or without jQuery. It doesn't matter at all do I use whole jQuery.

XUL file creates toolbar with a button which have "oncommand='Unlock()'" and it also includes .js file which have function Unlock()

Well. Anyways I think my default files has been setup correctly, because I have "alert('Starting...');" before the hide element line and it says "Starting..." with alert, but after that it doesn't made effects for the element in example "idofelement"

js file contains "document.getElementById('idofelement').style.visibility = 'hidden' I have tested different kind of methods that hide's the element in example style.display = 'none', but none of them works.

It always says "Starting..." so it executes the function correctly, but nothing happens after that.

I've created new Addon for my Firefox that I will use myself, but can't get it hide elements with or without jQuery. It doesn't matter at all do I use whole jQuery. XUL file creates toolbar with a button which have "oncommand='Unlock()'" and it also includes .js file which have function Unlock() Well. Anyways I think my default files has been setup correctly, because I have "alert('Starting...');" before the hide element line and it says "Starting..." with alert, but after that it doesn't made effects for the element in example "idofelement" js file contains "document.getElementById('idofelement').style.visibility = 'hidden' I have tested different kind of methods that hide's the element in example style.display = 'none', but none of them works. It always says "Starting..." so it executes the function correctly, but nothing happens after that.

פתרון נבחר

Found the solution. I've Googled this for many days, but didn't found a solution. Just used keywords "firefox addon getelementbyid" and selected "troubles" with it and found solution. I had to use:

content.document.getElementById("id") so in other words I had to add the 'content' word in front of document.

Thanks!

Read this answer in context 👍 0

כל התגובות (6)

more options

I just tested and document.getElementById("idofelement").style.visibility = "hidden" works in Firefox 26.0. You are doing something wrong. If you can show us your entire code, we can help you.

more options

Latest thing I tried was with jQuery. $("#portal-logo").hide();

So you can replace the $("#portal-logo").hide(); with all of those I mentioned above, but I can't get it work. I guess there's some permission problem.

Source attached via Dropbox.

more options

That also worked.

This is not Firefox's fault. You have made mistakes in your code. I can look into it later. If you find your mistake, don't forget to share it here.

more options

Oh O_o Well. Respond if you can later. I've to check it out too.

Thanks anyway :) and yeah. Sure I will share it here so people can find the solution from already made topics.

more options

פתרון נבחר

Found the solution. I've Googled this for many days, but didn't found a solution. Just used keywords "firefox addon getelementbyid" and selected "troubles" with it and found solution. I had to use:

content.document.getElementById("id") so in other words I had to add the 'content' word in front of document.

Thanks!

more options

Or maybe better window.content.document