Problem with jQuery Mobile dialog
I have a jQuery Mobile script which works but involves different dialog boxes for each time a numeric value is required from the user. So I tried to use one dialog box for all numeric values:
- <div data-role="dialog" id="dialogNum" data-theme="a">
- <div data-role="header"><h1>Decimal Coordinates</h1></div>
- <div data-role="content">
- <p id="inputDesc"></p>
- <input type="number" id="myNumber" data-mini="true" value="" />
- <a href="#" data-rel="back" data-role="button">Enter</a>
- </div>
- </div>
This works for the first inputs in each input box but the problem is that when I input a second value to either of the input boxes it overwrites the contents both of the input boxes and not just the one selected. Can anyone tell me why it is writing to both input boxes?
- $('#locAlat').click(function () {
- $.mobile.changePage('#dialogNum', 'pop', true, true);
- $('#inputDesc').text('Enter latitude in decimal format:');
- $('#myNumber').blur(function () {
- var num = $('#myNumber').val();
- $('#myNumber').reset;
- $('#locAlat').val(num + "°");
- });
- });
- $('#locAlon').click(function () {
- $.mobile.changePage('#dialogNum', 'pop', true, true);
- $('#inputDesc').text('Enter longitude in decimal format:');
- $('#myNumber').blur(function () {
- var num = $('#myNumber').val();
- $('#myNumber').reset;
- $('#locAlon').val(num + "°");
- });
- });