title: How to create span using jquery
body: <p>I have response from php in success of ajax,It is json object and i want to display each element in dynamically created span and click event on each span.I want all span should be in div1(div).I am trying below code.
  Does I require for loop??
  I want to create all span on single click event as I am calling $.ajax on single click for response.
  Thanks.</p>
  
  <pre><code>$('&lt;span/&gt;', {
      'id':'myspan',
      'class':'myClass',
      'text':'Text Only',
  }).on('click', function(){
      alert(this.id); // 
  }).appendTo('#div1');
  </code></pre>