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
Post a Comment