title: how to set the click event for dynamic generated button
body: <p>I am new to jquery. I wanted to generated a set of image button so i have done like this
  <code></p>
  
  <pre><code>  &lt;script type="text/javascript"&gt;
  $(document).ready(function(){
       $.support.cors = true;  
      if ($('#ulTask li').length == 0)
      {
          $.ajax({
              type: "POST",
              url: "http://diana/TaskManagerWebService/TaskManagerService.asmx/SelectAllTasks",
              data: "{}",
              contentType: "application/json; charset=utf-8",
              dataType: "json",
              success: OnSuccess,
              error: OnError
          });
          function OnSuccess(TaskData){        
              var TaskDataObj = jQuery.parseJSON(TaskData.d);                
              $.each(TaskDataObj, function (i, v) {
                 var TaskTypeUrl = getTaskTypeImageURL(TaskDataObj[i].TaskType), TaskId = parseInt(TaskDataObj[i].TaskId);
                $("#ulTask").append('&lt;li id="liTask'+TaskDataObj[i].TaskId+'"&gt;&lt;div id="divTask'+TaskDataObj[i].TaskId+'"&gt;&lt;img id="imgCollapse'+TaskDataObj[i].TaskId+'" alt="' + TaskDataObj[i].TaskId + '" src="Images/story_collapsed1.png" onclick="javascript:FillTaskDetails('+TaskDataObj[i].TaskId+');"/&gt;' + TaskDataObj[i].TaskName + '&lt;/div&gt;&lt;/li&gt;');
              });
          }
          function OnError(request, status, error){                
              alert(request.statusText);
          }
      }
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>for the image which i binded in li tag have onclick event.</p>
  
  <pre><code>onclick="javascript:FillTaskDetails('+TaskDataObj[i].TaskId+');"
  </code></pre>
  
  <p>I wanted to assign that click event in query formate like</p>
  
  <pre><code>$("#imageId").click(function(){
  });
  </code></pre>
  
  <p>how to i get this "imageId", Actually this imageid is combination of text and dynamic value</p>
  
  <pre>&lt;img id="imgCollapse'+TaskDataObj[i].TaskId+'".......
  </code></pre>
  
  <p>Thanks in advance</p>