Note that there are some explanatory texts on larger screens.

plurals
  1. POLoad Same Code Twice In Separate Div
    primarykey
    data
    text
    <p>I'm creating a resource database that has a scrolling container on the side. Essentially, when you click a thumbnail within the container, it will load the contents of a div which will fade in and display content for that category. Each div tag looks something like this:</p> <pre><code>&lt;div&gt; &lt;h2&gt;Category1&lt;/h2&gt; &lt;p&gt;&lt;a style="float:right" class="a_demo_four" href="/Resources/file1.pdf" target="_blank"&gt; Download &lt;/a&gt;File Desc&lt;/p&gt; &lt;hr/&gt; &lt;/div&gt; </code></pre> <p>And will load as such: <img src="https://i.stack.imgur.com/CX3XV.png" alt="image"></p> <p>Essentially, I want to be able to display the same exact content when I open another category on this page. I have several different categories, and want to be able to pull the code from say Category1, Category2, and so on and so forth so I can display all of them in a "View All" tab. I've attempted to use jQuery's load function as seen below:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script src="http://code.jquery.com/jquery-1.9.1.js"&gt;&lt;/script&gt; &lt;script&gt; $(function() { $("#includedContent").load("b.html"); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="includedContent"&gt;&lt;/div&gt; &lt;h1&gt;This is why I rule&lt;/h1&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>to load the content from the original div into the view all category, but nothing shows up. Unfortunately, I have very limited knowledge with Javascript/jQuery so I'm having difficulty being able to use the same content in a different div without just copying and pasting the code over. This would also pose problems in the future when I am adding files and have to edit the code twice if I did so.</p> <p>Thank you in advance!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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