title: how to take input text from alert box
body: <p>I have a form in which there are input fields for mobile number ,name and email.I have two buttons add and group.Add button  add new records of the selected records.Group button is used to create a group of selected fields on the records.So when you click on group button it will ask whether to create a group or not.If yes then it will create a group named as 0 or 1.But I want to give some name(user should type the name to be given) to the group.Please tell me how to do.This is the <a href="http://jsfiddle.net/4GP9c/172/" rel="nofollow noreferrer">fiddle</a> and this is the screenshot</p>
  
  <p>This is the jquery</p>
  
  <pre><code>var val = 0;
  var groupTrCount = 0;
  $(document).ready(function () {
      var obj={};
      $('#btn1').click(function () {
          if ($(".span4").val() != "") {
              $("#mytable").append('&lt;tr id="mytr' + val + '"&gt;&lt;/tr&gt;');
              $tr=$("#mytr" + val);
              $tr.append('&lt;td class=\"cb\"&gt;&lt;input type=\"checkbox\" value=\"yes\" name="mytr' + val + '" checked &gt;&lt;/td&gt;');
              $(".span4").each(function () {
                  $tr.append("&lt;td &gt;" + $(this).val() + "&lt;/td&gt;");
              });
              var arr={};
              name=($tr.find('td:eq(1)').text());
              email=($tr.find('td:eq(2)').text());
              mobile=($tr.find('td:eq(3)').text());
              arr['name']=name;arr['email']=email;arr['mobile']=mobile;
              obj[val]=arr;
              val++;
          } else {
              alert("please fill the form completely");
          }
      });
      $(document).on('click', '#btn2',function () {
          var creat_group = confirm("Do you want to creat a group??");
          if (creat_group) {
              console.log(obj);
  
              $("#groupsTable").append('&lt;tr id="groupTr' + groupTrCount + '"&gt;&lt;/tr&gt;');
              $tr=$("#groupTr" + groupTrCount);
              $tr.append("&lt;td &gt;" + groupTrCount + "&lt;/td&gt;");
              var userColumn = "&lt;ul&gt;";
              $('#mytable tr').filter(':has(:checkbox:checked)').each(function() {
                  var count=0;
                  $(this).find('td').each(function() {
                      if(count == 1){
  
                          userColumn+= "&lt;li&gt;" + $(this).html() + "&lt;/li&gt;" ;
                      }
                      count++;
                      });
              });
              userColumn+="&lt;ul&gt;";
              $tr.append("&lt;td &gt;" +userColumn+ "&lt;/td&gt;");
          groupTrCount++;
          }        
      });
      $(document).on('change','#mytable input:checkbox',function () {
          if(!this.checked)
          {
              key=$(this).attr('name').replace('mytr','');
              alert(key);
              obj[key]=null;
          }
      });
  });
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/JryyD.png" alt="enter image description here"></p>