I have select button on my page which creates DIV
elements onClick
event but when I toggle from one value to the next value. I want my divs, to be replaced with new ones, not only create multiple ones. Is there any smart way of doing this?
Here is the onChange
select button code:
<div class="select">4Sprint
<select id="four_sprint_select" onchange="selected_four_sprint(value);">
<option>Select</option>
<option value="541">Start sprint 541</option>
<option value="605">Start sprint 605</option>
<option value="617">Start sprint 617</option>
<option value="629">Start sprint 629</option>
<option value="641">Start sprint 641</option>
</select>
</div>
Solution could be getting that element, where all the magic happens and you insert divs, and make it's innerHTML equal to null. After that you insert new ones. So Process: 1) User chooses new option from select element 2) Onchange event triggers function that at first deletes previous data and after that inserts new one.
Hope this solutions helps :)