select tag will not reset to default

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AC Patel
    New Member
    • Apr 2011
    • 3

    #1

    select tag will not reset to default

    I have made mant types of fields in a form and can reset it with no problems but the select field will not reset
    Acutally it does reset but it will not return to the default value
    can anyone tell me where i am going wrong
    here is the code

    Code:
    <html>
    <head>
    <meta charset="utf-8">
    <title>Starter Page</title>
     
    <link href="jquery-mobile/jquery.mobile-1.2.0.min.css" rel="stylesheet" type="text/css">
    <script src="jquery-mobile/jquery-1.8.3.min.js" type="text/javascript"></script>
    <script src="jquery-mobile/jquery.mobile-1.2.0.min.js" type="text/javascript"></script>
     
     
     
     
    <script language="javascript" type="text/javascript">
     
    function formReset(){
            $('#frm1').get(0).reset(); 
            }
       </script>
     
    </head>
    <body>
     
    <div data-role="page" id="stater_page">
     
        <div data-role="header" data-position="fixed" >
                    <h1>City</h1>
        </div><!--End of header div-->
        
        <div data-role="content">
            
            <form id="frm1">
                 <div id="selection">
                    <label for="selectmenu" class="select">Choose City:</label>
                    <select name="choice" data-mini="true" class="select-btn-font" id="choice">
                        <option value="" selected="selected">Choose City</option>
                        <option value="1">Los Angeles</option>
                                            <option value="2">San Diego</option>
                                            <option value="3">San Fransisco</option>
                    </select>
                  </div>
                    <input name="chg" type="number" class="input-font" id="chg" value="" data-mini="true" />
                    <input type="reset" onclick="reset()" value="ResetForm"/>
            </form>
                  
        </div><!--End of content div-->
        
        <div class="text-center" data-role="footer" data-position="fixed">
            City Guide &copy; 2012
        </div><!--End of footer div-->
        
    </div><!--End of Starter Page-->
     
    </body>
    </html>
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    since you use a reset button, drop that event, it does nothing other than the reset button itself. … and it works for me.

    Comment

    Working...