javascript - Capture value on page submit -


i web developer, in application have form , text box. if type text in text box , when submit value not getting captured, taking default value.

    <form class="form-search" onsubmit="myfun();return false;" name="myfrm">       <input type="text" name="search" id="search" style="width:225px" style="height:5px" placeholder="enter city or area..." value="jayanagar,bangalore" >       <input type="submit" value="search" class='btn btn-default'>     </form>      <script>         myfun(){                     window.location.reload();             }      </script> 

it should capture textbox value before refreshing.    and captured data passed api parameter.  i unable capture data. in firefox working expected. how can this?

text box value can captured..

<form class="form-search" onsubmit="myfun();return false;" name="myfrm">      <input type="text" name="search" id="search" style="width:225px" style="height:5px" placeholder="enter city or area..." value="jayanagar,bangalore" >      <input type="submit" value="search" class='btn btn-default'> </form> <script>  function myfun(){          // correct way of defining function     alert(document.myfrm.search.value);            /*        can here ever want.       */         window.location.reload();     }  </script> 

first thoroughly other questions similar problem , ask question. not here make reputation.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -