Jquery - Javascript DHTML - Developer Resourses - Creating Select Dropdown List Options dynamically with Jquery ::: Lionfish Tehcnologies



Home / Developers Resourses / Tips

Detecting change on Input text made by javascript code using Jquery 'Data'

Here is the code

 var count = 1;
 jQuery(document).ready(function($) {
    // Save current value of element
    $("#txtMonitored").data('oldVal', $(this).val());

    // Look for changes in the value
    $("#txtMonitored").bind("propertychange keyup input paste", function(event){
       if ($(this).data('oldVal') != $(this).val()) {
          // Updated stored value
          $(this).data('oldVal', $(this).val());

          // Do action -----
          $("#dvHistory").append(count + ".- " + $(this).val() + "<br/>");
          count++;
          //----------------
       }
    });
});

function FillText(){
$("#txtMonitored").val($("#txtMyText").val());
}



Here is the live sample.

Detecting change on Input text made by javascript code using Jquery 'Data'

Texbox:
  with :
Change History:
[No Change]




Lionfish Technologies ® 2009 All rights reserved