Jquery – Detect changed input text box


I've looked at numerous other questions and found very simple answers, including the code below. I simply want to detect when someone changes the content of a text box but for some reason it's not working… I get no console errors. When I set a breakpoint in the browser at the change() function it never hits it.

$('#inputDatabaseName').change(function () { 
<input id="inputDatabaseName">

Best Solution

You can use the input Javascript event in jQuery like this:


In pure JavaScript:

document.querySelector("input").addEventListener("change",function () {
  alert("Input Changed");

Or like this:

<input id="inputDatabaseName" onchange="youFunction();"
onkeyup="this.onchange();" onpaste="this.onchange();" oninput="this.onchange();"/>