How to call a function after textbox lose focus

Viewed 48815

I have no experience with Javascript/JQuery/AJAX so I'm trying to understand if it's possible to call a function that execute a query on my DB after a textbox lose focus.

I'm displaying a table in my page (using PHP) with text boxes that contains the same values of a table on my DB, and when someone change the value on a text box I want to change the DB table with an UPDATE query to make them equals; is that a way with AJAX or JQuery to do this?

4 Answers

<form id='form'>
  <label for="name">name:</label>
  <input type="text" name="name" onblur="makePink()">
</form>

<script>
    function makePink() {
       document.body.style.backgroundColor = 'pink';
    }
</script>

Related