title: Having a same function for the same event but different objects jquery
body: <p>I am creating a dynamically LI with jquery.</p>
  
  <p>I have this jquery for changing the names of the li. I don't want to create a new function with the ID of the li for doing this. I don't consider this the best way of doing it. Imaging I add 100 li, I will have 100 functions. Which will be the best way of doing this.</p>
  
  <p>I have my demo here: <a href="http://jsfiddle.net/DiegoTc/dXX9G/" rel="nofollow">http://jsfiddle.net/DiegoTc/dXX9G/</a></p>
  
  <pre><code>&lt;div class="col-md-3 well"&gt;
  &lt;ul class="nav nav-pills nav-stacked" id="myTab"&gt;
  &lt;li id="pTabP" class="active"&gt;
      &lt;a href="#tab_preview" data-toggle="pill"&gt;
          &lt;span  id ="tabPr1" class="display"&gt;Preview Card&lt;/span&gt;
          &lt;input type="text" class="edit" style="display:none"/&gt;
      &lt;/a&gt;
  &lt;/li&gt;
  &lt;li id="fTab"&gt;
      &lt;a href="#tab_GInfo" data-toggle="pill"&gt;
          &lt;span  id ="tabG1" class="display"&gt;General Info&lt;/span&gt;
          &lt;input type="text" class="edit" style="display:none"/&gt;
      &lt;/a&gt;
  &lt;/li&gt;
  
  
   $("#pTabP").dblclick(function(){
     $("#tabPr1").hide().siblings(".edit").show().val($("#tabPr1").text()).focus();
   });
   $("#fTab").dblclick(function(){
     $("#tabG1").hide().siblings(".edit").show().val($("#tabG1").text()).focus();
   });
   $(".edit").focusout(function(){
      $(this).hide().siblings(".display").show().text($(this).val());
   });
  </code></pre>