php - Using JavaScript to Modify a Page on the Fly based on <select> contents -


So, I've got a form and a inside the form . Which is based on the selection (which is option & gt; selected), I have to change the contents of the form on the fly (i.e., before the user clicks anything).

For example, if the user selects the Photo upload option, a file upload box will appear, and if they select text entry , This file upload box will appear instead of a text box.

Thank you.

  function swapDiv (index) {var html = ''; Assign html var based on the index {... // index; } Div.innerHTML = html; // div html html allocations} select.onchange = function () {swapDiv (this.selectedIndex); }  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -