Why can I not trigger an input from checkbox label?

Why can I not trigger an input from checkbox label?

Hello,

after three day of searching I still not know why I can not trigger an input field(for use of virtual keyboard) from a checkbox label.

Can someone explain me what i am doing wrong?

Html:

  1. <div>
  2.      <label for="checkbox-0">I agree<input type="checkbox" name="checkbox-0" /></label>
  3.      <div><input name="test" type="number" id="amount_checkbox-0"></input></div>
  4. </div>

Script:
  1. $(function() {
  2.     $('label').click(function() {
  3.         labelID = $(this).attr('for');
  4.         alert($('#amount_'+labelID).attr("name")); //working
  5.         $('#amount_' + labelID ).trigger("click");      //only working on pc
  6.     });
  7. });

Goal: Press on the label of checkbox, Checkbox will be checked and input must be clicked so that the virtual keyboard of the phone will be displayed.

  


Thanks in advance