1

I'm trying that when I change into drop-down, the input box should be focused and value of input box should be selected. I used

$("#text_qty").focus(function () {
    this.select();
});

but it is not working .

This is my input box

<input type="number" name="text_qty" id="text_qty"  value="0" onKeyUp="cal_price()" onChange="cal_price()" min="0"/>
pavan sp
  • 105
  • 2
  • 17
Jon
  • 87
  • 1
  • 5

2 Answers2

0
   $(document).ready(function () {
       $("#text_qty").focus(function () { $(this).select(); });
   });
Jobelle
  • 2,717
  • 1
  • 15
  • 26
0

This should work.

$("#select").change(function () {
        $("#text_qty").focus();
        $("#text_qty").val($("select option:selected").val());
    })
pavan sp
  • 105
  • 2
  • 17