jQuery get value of input datetime-local -


i need value input datetime-local, variable empty, whereas ok text inputs. here code:

<script> var datetimeval = $("#datetime").val(); var textval = $("#text").val(); </script> <input id='text' type='text' /> <input id='datetime' type='datetime-local' /> 

could tell me please, how fix it?

try this

<input id='text' type='text' value="test"/> <input id='datetime' type='datetime-local' /> <script> var datetimeval = $("#datetime").val(); var textval = $("#text").val(); alert(textval);  alert(datetimeval); </script> 

demo: fiddle

note: gave default value text input textbox


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 -