0

I have a following page where I set default selected item in drop down list. I select a new value from select drop down list .After page refresh that value is selected but not the default selected.I am using Mozilla Firefox.This is not happening in chrome. What is the reason for this behavior in Firefox(version-35.0.1). I need to know why different things happening in chrome and in firefox.

<html>
<head>


<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">

<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

<!-- Latest compiled JavaScript -->
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>

<link rel="stylesheet" type="text/css" href="style.css">

</head>
<body>
<div class="container">

<form name="" action="auth.php" method ="post">
<div>
 <table id="one-column-emphasis">  
<tr>
<th>
Student Name:</th>
<td><input type="text" name="student_name" required>
</td>
</tr>
<tr>
<th>Mobile No/Email </th>
<td><input type="text" name="mobile" required>
</td>
</tr>
<tr>
<th>Examination:</th>
<td><select name="exam"id="exam"onchange="myFunction()" required>
                          <option value="hs"selected>HS</option>
                          <option value="cbse">CBSE</option>
                          <option value="icse">ICSE</option>
                          <option value="other">OTHER</option>
            </select>
        </td>
        <td><input type="hidden" name="other_exam" id="other_exam"></td>
    </tr>
<tr>
<th>Board:</th>
<td><select name="board" onchange="myFunction1()"id="board"required>
                          <option value="WBCHSE" selected>W.B.C.H.S.E</option>
                          <option value="cbse">C.B.S.E</option>
                          <option value="icse">I.C.S.E</option>
                          <option value="other">OTHER</option>
            </select>
        </td><td><input type="hidden" name="other_board" id="other_board"></td>
    </tr>
<tr>
<th>Roll No</th>
<td><input type="text" name="roll"required>
</td>
</tr>
<tr>
<th>Year of Passing</th>
                        <td><select name="yop"required>
                             <option value="2013"selected>2013</option>
                             <option value="2014">2014</option>
                             <option value="2015">2015</option>
                             </select>
                         </td>
</tr>
<tr>
    <td >
<input type="reset" name="submit" value="Reset">
    </td>
    <td>

<input type="submit" name="submit" value="Next">
    </td>
</tr>
</table>
</form>
</div>
<script>
function myFunction() {
    var x = document.getElementById("exam").value;
    if(x=="other")
document.getElementById("other_exam").type = "text";
   else
document.getElementById("other_exam").type = "hidden";
}
function myFunction1() {
    var x = document.getElementById("board").value;
    if(x=="other")
document.getElementById("other_board").type = "text";
else
document.getElementById("other_board").type = "hidden";
}

</script>



</body>
</html>
Xax
  • 185
  • 6
  • 18
  • When you reload the page it won't maintain your selection unless you set up some sort of cookie. – APAD1 Mar 06 '15 at 20:31
  • @APAD1 i run only the given code noting else.Is it for the browser ? – Xax Mar 06 '15 at 20:34
  • yeah,but i want to know why this behavior is happening in Firefox @APAD1 – Xax Mar 06 '15 at 20:42
  • He told you why, when the page reloads it reverts to original value. – EternalHour Mar 06 '15 at 20:46
  • @EternalHour its not the case that when i refresh the page goes back to original value. The selected item is not changing as i said .i want to no why in firefox it is not changing – Xax Mar 07 '15 at 03:14
  • @jon see the difference in question i want the reason not solution.The question You referring is a different from what i want and there is no good explanation . – Xax Mar 07 '15 at 03:19
  • @avi: "Because Firefox wants to do it like that" is not a good explanation? What more do you want to know? The name of the developer who checked in that code? – Jon Mar 07 '15 at 15:27
  • @Jon First of all why you make it duplicate.and if you not no the reason then then let someone give the answer .fyi it is only behaving for this code. – Xax Mar 09 '15 at 16:00
  • @avi: I made it a duplicate because I think it's a duplicate, and I haven't yet managed to understand why it should not be. If you feel that this is wrong, please flag the question for moderator attention and explain to them. – Jon Mar 09 '15 at 17:10

0 Answers0