Within this function I want to check that the focused input is a specific input, I want to do this by matching the input names together.
Is something like the below snippet possible?
$('body').on("keyup", "input", function() {
if( $(this) == $('input[name="title"]'))
alert('ok');
});
When I console.log $(this) it returns an object. I’m not sure how I’d go about checking the object for the input name.
I’m not sure about object comparision but you could use instead
avoiding creation of object juste for comparison 😉
You can also write a more specific filter to directly listen on the good element :