title: Adding onChange function dynamically while appending
body: <p>i've been asking myself some jquery issues for a while since i fail googleing questions caused by a lack of 'the lingo' maybe. It's about creating an element in jquery dynamically. So i could do it like:</p>
  
  <pre><code>placeElement = $('&lt;select/&gt;');
  
  placeElement.on('change', function () { do_sthg(); });
  </code></pre>
  
  <p>I could do it in different ways, just to give an example what i mean. </p>
  
  <p>I created a function a while ago, that add's elements to a page when the user clicks on an edit button, worked fine so far. But as i edited this function later i stumbled upon the fact that i create elements like shown below and now want to add a onChange-Function in that "type of creating an element".  </p>
  
  <pre><code>$("#edit td."+value).append(
      $("&lt;select/&gt;", {
          'name': value,
          'id':'rankid_select'
      })
  );
  </code></pre>
  
  <p>when i add it to the element</p>
  
  <pre><code>$("&lt;select/&gt;", {
      'name': value,
      'id':'rankid_select',
      'onchange': function () {
          check_something_that_could_be_wrong();
       }
  })
  </code></pre>
  
  <p>the function is called whenever the edit button is clicked, just like an ordinary function but not on changing the select-element. So based on that i have 3 questions:</p>
  
  <ol>
  <li>how do i call that different styles i can create elements with in jquery? Like <code>$('#element').html('...').attr('...').etc('...')...;</code> 
  or as seen above <code>$("&lt;select/&gt;", { 'name': value, 'id':'rankid_select' })</code>.</li>
  <li>How do i add a function in the shown type of creating an element?</li>
  <li>Is one of the solutions above 'wrong' or 'dirty' from a pro-programmers view?</li>
  </ol>
  
  <p>thank u so much!</p>