html - dynamic drop down form using JavaScript -


i'd have drop down form using javascript. need create question essentially. how works: person, home page, click "create question" , go create question page. on page, first question asks person "what type of question ask?" , then, via few radio buttons, can select type want, either "multiple choice", "select best" or "short answer". point, more of form appears…in other words, depending on type of question want ask, different set of criteria asked them fill out before submitting server question they'd ask. make sense? here form far:

    <!doctype html>     <html>         <head>             <title>quick bump</title>             <link href="styles.css" type="text/css" rel="stylesheet" />         </head>          <body>             <div class="center">              <h1 class="welcomeheader">create question:</h1>             <form action="http://www.example.com/profile.php">              <p class="pstyle">please select type of question you'd ask:                 <br />                 <br />                 <input type="radio" name="genre" value="multiple choice" checked="checked" /> multiple choice                 <input type="radio" name="genre" value="select best" /> select best                 <input type="radio" name="genre" value="short answer" /> short answer             </p>             <br />              <p class="pstyle">what question?                 <br />                 <br />                 <label>q:<input type="text" class="resizedtextbox" name="question" /></label><br />             </p>             <br />              <p class="pstyle">what answers available?                 <br />                 <br />                 <label>a:<input type="text" class="resizedtextbox" name="answer 1" /></label><br />                 <label>b:<input type="text" class="resizedtextbox" name="answer 2" /></label><br />                 <label>c:<input type="text" class="resizedtextbox" name="answer 3" /></label><br />                 <label>d:<input type="text" class="resizedtextbox" name="answer 4" /></label><br />             </p>             <br />              <p class="pstyle">would submit question now?</p>             <input type="submit" class="submitlink" name="submit form" value="submit" />         </form>     </div>     <br />     <div class="footer">         <a href="firstwebpage.html" class="links">home</a>     </div> </body> 

you can use jquery incrementally show each successive paragraph previous form element changed.

here's example started: http://jsfiddle.net/kevincollins/uarzb/

$(function () {     $('.pstyle:first').show();     $('input[name="genre"]').change(function(){         $('.pstyle:eq(1)').show();     });     $('input[name="question"]').change(function(){          $('.pstyle:eq(2)').show();     });     $('input[name^="answer"]').change(function(){          $('.pstyle:eq(3)').show();     }); }); 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -