Note that there are some explanatory texts on larger screens.

plurals
  1. POReplace entire DIV with a custom DIV using JQuery in a Chrome extension
    text
    copied!<p>I'm building an extension in Chrome for an internal tool we use. We have had this tool for a few years and the navigation menu has never worked in Chrome. The developers refuse to fix it. So part of what I am attempting to do with my extension is to replace the menu with a functioning menu.</p> <p>Currently the menu is wrapped in a DIV. I want to replace that entire DIV with a new DIV with a working menu. At first I thought it would easy enough to use JQuery's replaceWith() function but replaceWith() only seems to work on single pieces of code. I was able to easily replace the entire Menu with a single element. Then I came across .load() but I was not able to successfully get the .html file in the extension folder to actually load.</p> <p>I shortened this menu but it is an example of the current DIV:</p> <pre><code>&lt;div id="ctl00_MasterMenu" class="MenuStyle ctl00_MasterMenu_5" style="height:20px;"&gt; &lt;span class="MenuItemStyle ctl00_MasterMenu_4"&gt; &lt;a class="ctl00_MasterMenu_1 MenuItemStyle ctl00_MasterMenu_3" href="default.aspx" style="border-style:none;font-size:1em;"&gt;Home&lt;/a&gt; &lt;/span&gt; &lt;span class="MenuItemStyle ctl00_MasterMenu_4"&gt; &lt;a class="ctl00_MasterMenu_1 MenuItemStyle ctl00_MasterMenu_3" href="javascript:__doPostBack('ctl00$MasterMenu','o6')" style="border-style:none;font-size:1em;"&gt;New Ticket Expand New Ticket&lt;/a&gt; &lt;/span&gt; &lt;/div&gt; </code></pre> <p>And I basically want to replace it with something like:</p> <pre><code>&lt;ul&gt; &lt;li&gt;Home&lt;/li&gt; &lt;li&gt;New Item&lt;/li&gt; &lt;li&gt;New Item2&lt;/li&gt; &lt;/ul&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload