I am adding div element after a button is clicked, but only if it doesn't already exist (from a previous click).
Currently it keeps adding the element as the new DOM doesn't seem to be picked up by JQuery.
   var validationMessage = function(msg, elemId) {
      var valId = elemId + "_valId";
      if($(valId).length == 0) {
          $("<div id='" + valId + "' class='error-message'>" + msg + "</div>").insertAfter(elemId);
      }
    };
I run validationMessage in my click event:
$("#ele1").click(function(e) {
   // validationMessage called in here
});
Why doesn't jQuery pickup the new DOM?
I'm using 1.9.1
