Using .load to fetch specific lists

/ What I'm trying to do is load certain lists in a file (template) across multiple pages. I want to have a template file with all the lists that I can edit and affect all the lists on all pages. What I think I need to do is use .load to fetch the lists. I tried the code provided on this page titled "Loading other page list items into an ordered list". But I cannot understand what I need. I cannot use php as my host does not support it (github)

   $( "#new-projects" ).load( "/ #Colors li" );
   $( "#new-projects" ).load( "/ #Numbers li" );
   $( "#new-projects" ).load( "/ #Misc li" );
      

<ol id="new-projects">List:</ol>
<ol id="new-projects">List:</ol>
<ol id="new-projects">List:</ol>


My Template List file (listtemplate.html)

<div id="Colors">
        <li>blue</li>
        <li>black</li>
        <li>white</li>
      </div>
      
      <div id="Numbers">
        <li>one</li>
        <li>two</li>
        <li>three</li>
      </div>

      <div id="Misc">
        <li>House</li>
        <li>Rake</li>
        <li>Hat</li>
      </div>
      
      

Run codeHide result


The code used on the .load info site that I want to use to highlight a specific list.

   $( "#new-projects" ).load( "/resources/load.html #projects li" );

      

+3
javascript jquery github github-pages


source to share


No one has answered this question yet

Check out similar questions:

2628
How do I insert an element into an array at a specific index (JavaScript)?
2132
Get selected text from dropdown (select field) using jQuery
1799
Generating random integers in JavaScript within a specific range?
1566
Get selected value in dropdown using JavaScript
1184
jQuery get specific text of option tag
314
Reverse AngularJS route change before model load to prevent flickering
169
Accessing clicked element in angularjs
73
How do I sync documents to Github Pages?
0
How do you get an angularJS w / typescript project to work on a website?
-2
External jQuery on individual WordPress pages is loaded but not launched



All Articles
Loading...
X
Show
Funny
Dev
Pics