How to get selected index from datalist in javascript.
                            
                         
                        
                     
                 
                
                    In my code I am adding following code in javascript and datalist
Javascript: 
 <script type="text/javascript">
               $("[id*=Button1]").live("click", function () {
                   $("#dialog").dialog({
                       title: "New Name",
                       buttons: {
                           Submit: function () {
                                var item = name.value;
                               alert("New Name : " + item);
                              
                              window.open("Page1.aspx?albumname=" + item);
                           
                              return false;
                               }
                       }
                   });
                   return false;
               });
    </script>
Datalist:
<asp:DataList ID="datalist" RepeatDirection="Horizontal" DataKeyNames="val1"  RepeatColumns="6"   AlternateText=" "  runat="server"  Height="102px" Width="229px" CellSpacing="5"    > 
<ItemTemplate > 
   
<asp:TextBox ID="txt" runat="server" Text='<%# Eval("val1") %>' ReadOnly="true" Enabled="false"    />
         <asp:Button ID="Button1" runat="server" Text="Edit"  Height="30" Width="40"   AlternateText=" " >
    
            </asp:Button> 
</ItemTemplate>
  
</asp:DataList>
When I click on edit button in datalist then above javascript popup is coming
What I want is when I click on edit button value of textbox associated with it should be also show in alert.
How to show such a value?