I have developed a mobile app using the jquery-mobile framework. I need the value entered by user in input field. <input type="number" size="35" value="Enter a Number..." step="0.01" placeholder="Enter a Number...">
If any number is entered then it's value gets successfully but if entered anything except a number it becomes invalid and its value showing as blanks, Is there any way to get entered value?
I guess that related to something with jqmobile.
Even if you add the clearBtn widget, when you input invalid strings it's not showing:
document.querySelector('input[type="number"]').addEventListener('change', function() {console.log(this.value)});
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<input type="number" size="35" value="Enter a Number..." step="0.01" placeholder="Enter a Number..." data-clear-btn="true" />