0

Suppose I have a form in Which contains a numberinputs and textareas. How do I identify which one is currently clicked on?

   $('body').on('change', 'input textarea', function() {

            })

In other words,How detect which type is currently clicked, inputs or textareas?

arman
  • 649
  • 1
  • 10
  • 27

1 Answers1

0

Better you can try like this forms also have an elements collection, sometimes this differs from children such as when the form tag is in a table and is not closed.

$("form").each(function(){
  $(this).find(':input') //<-- Should return all input elements in that specific form.
});
Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
  • This is completely unrelated to what the OP has asked, and what they are attempting to achieve. You seem to have misunderstood the question. – Rory McCrossan Apr 05 '18 at 13:12