I have this code using jQuery:
$( 'form' ).submit(function( event ) {
var $input = $(event.target).find('input');
var comment = $input.val();
});
Can we use $(this) instead of the event.target here ?
Our overall task is to find the input element and its value
Here goes the replaced code:
$( 'form' ).submit(function(event) {
var $input = $(this).find('input');
var comment = $input.val();
});