dimanche 29 avril 2018

Insert 2 selected checkbox into 2 textfield

I have multiple checkbox that can be selected by user, however i cant find out a way how to distinguish each values into 2 different textfield

As you can see i have multiple choice of checkbox, but user can only check 2 checkbox because it will set the timestamp range.

enter image description here

But, i end up with this code, and it does not work as i wanted as it displays the same thing in both texfield

 $('input[type="checkbox"]').on('click', function() {
   var is_checked = $(this).prop('checked');
   var val = '';
   if (is_checked) val = this.value;
   $('input[text="input"]').val(val);
 });

And it displays like this:

enter image description here




Aucun commentaire:

Enregistrer un commentaire