You are viewing limited content. For full access, please sign in.

Question

Question

.on 'keyup' only works for existing fields on the form, not ones added in a table

asked on April 19, 2017 Show version history

I am trying to use .on('keyup' but some of the fields don't exist when the form loads. They are added by using the Add feature of tables. Is there a way to have a function run when they release keys on those fields as well? I am not looking to do a foreach, just a single onkeyup for each individual field.

Example code

 $('.myclass input').on('keyup', function() {

   var res = $(this).val(); 
    
	});

 

 

0 0

Answer

SELECTED ANSWER
replied on April 20, 2017

Let's give the table css class "table" and field in table css class "field", then the script could be like this:

$(document).ready(function(){
  $('.table').on('keyup', '.field input', function(){
    console.log($(this).val());
  });
});

 

0 0
replied on April 20, 2017

You rock!!

0 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.