title: bind onerror with dynamically created image tag in jquery
body: <p>i am trying to bind the onerror of img with a function. image tag is created like this in jquery</p>
  
  <pre><code>this._img1 = $("&lt;img&gt;");
  </code></pre>
  
  <p>this is the function</p>
  
  <pre><code>function imgError(image) {
    image.onerror = "";
    image.src = '/Content/img/placeholder-profile.jpg';
    return true;
  }
  </code></pre>
  
  <p>now i want to bind this function with onerror ...
  i've tried following things and they wont work for me </p>
  
  <pre><code>this._img1.on("onError", "imgError(" + this._img1 + ")");
  </code></pre>
  
  <p>and </p>
  
  <pre><code>this._img1.prop("onError", "imgError(this)");
  </code></pre>
  
  <p>and </p>
  
  <pre><code>this._img1.error(function () {
      _img1.src = '/Content/img/placeholder-profile.jpg';
  });
  </code></pre>
  
  <p>can anyone suggest me how can i achieve it ?</p>