2021年4月29日星期四

How do I get a dropdown list to load a js file?

Creating a quiz and I want to load a js file based on the selection from a dropdown box, so far I have the following to assign the class as the category-name:

    <div>        <label for="test">Select test:</label>        <select id="test" class="category-name" name="test">          <option value="a.js">A</option>          <option value="b.js">B</option>          <option value="c.js">C</option>         </select>      </div>        <button type="button" class="btn btn-primary lift" onclick="loadQuestionsForCategory()">Load Questions</button>            </section>        <script src='assets/resources/questions.js'></script>    

Instead of loading questions.js, how would I load a.js or b.js depending on the option that's selected?

https://stackoverflow.com/questions/67327976/how-do-i-get-a-dropdown-list-to-load-a-js-file April 30, 2021 at 11:54AM

没有评论:

发表评论