Im trying to get a drop down box to duplicate when a user presses a button but it just refreshes the page on click
HTML Code:<form id="form"> <select id="time2" name="time2"> <option value="N/A">N/A</option> <option value="Archery range">Archery Range</option> <option value="Rifle range">Rifle Range</option> <option value="Climbing wall">Climbing Wall</option> <option value="Grass sledges">Glass Sledges</option> <option value="Go karts">Go Karts</option> <option value="Camp fire circle">Camp Fire Circle</option> <button id="add">Add</button> </select> </form>
Code:document.getElementById( 'add' ).addEventListener( 'click', function ( event ) { event.preventDefault(); var select = document.getElementById( 'select' ).cloneNode( true ); document.getElementById( 'form' ).appendChild( select ); }, false );


Reply With Quote
Bookmarks