Jquery mobile, implement popup with numeric input, plus/minus buttons -
i trying create popup dialog box user can input amount of x (numeric), plus , minus button.
after long, unsuccessful, search exist solution.
i use jquery.mobile.simpledialog2.min.js.
--------- code: ------------------
<script type="text/javascript"> $(document).delegate('#inliner', 'click', function() { $('#inlinecontent').simpledialog2(); }); $(document).delegate('#amount_plus', 'click', function() { x = $('#prod_amount_input').val(); x = eval(x)+1; $('#prod_amount_input').val(x); //$('#prod_amount_input').textinput('refresh'); //$('#prod_amount_input_div').textinput('refresh'); //$('#prod_amount_input').trigger('create'); //$('#prod_amount_input_div').trigger('create'); alert($('#prod_amount_input').val()); }); $(document).delegate('#amount_minus', 'click', function() { $('#inlinecontent').simpledialog2(); }); </script> <a href="#" id="inliner" data-role="button">open dialog #1</a> <div id="inlinecontent" style="display:none" data-options='{"mode":"blank","headertext":"amount","headerclose":false,"blankcontent":true}'> <div class="ui-grid-b"> <div class="ui-block-a"><a rel='' data-role='button' href='#' id="amount_plus">+</a></div> <div class="ui-block-c" id="prod_amount_input_div"> <input type="number" name="number" id="prod_amount_input" value="0" > </div> <div class="ui-block-b"><a rel='' data-role='button' href='#' id="amount_minus">-</a></div> </div> <a rel='close' data-role='button' href='#'>close</a> </div>
--------------- code end ---------------
if use:
$('#prod_amount_input').textinput('refresh');
or
$('#prod_amount_input_div').textinput('refresh');
the application go index.html page (from page popup opened from).
if use:
$('#prod_amount_input').trigger('create'); $('#prod_amount_input_div').trigger('create');
nothing happens.
from: alert($('#prod_amount_input').val());
know value changed, value in input field doesn't.
some ideas how update numeric input value in popup ?
what try create like: http://imgur.com/q0vef
thanks!
Comments
Post a Comment