Can't get function to execute RRS feed

  • Question

  • Please excuse me if this is posted in the wrong place. I am new to javascript and haven't worked with in a long time. 

    I want to execute a javascript function when a button on my page is clicked, then I need to access the value in my hidden field in my code. This is a simplified version of my code. I am not getting an error, but the "GetTheIndex" function just never executes. Can someone please tell me what I am doing wrong?

    <%@ Page Title="View Request" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="ViewExisting.aspx.vb" Inherits="MyPage.ViewRequest" %>
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

    <asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
        <link href="StyleSheet1.css" rel="stylesheet" type="text/css" />

        <script src="Scripts/jquery-3.3.1.min.js"></script>
        <script type="text/javascript">

            function GetTheIndex() {

                document.getElementById("myHiddenField").Value = document.getElementById("Label1").textContent; 



         <asp:HiddenField ID="myHiddenField" runat="server" />
         <asp:Label ID="Label1" runat="server" Text="One"></asp:Label>

         <asp:Button ID="btnSaveChanges" runat="server" Text="Save Changes" onchange="GetTheIndex()"/>  


    -----------------------------  Code Behind  --------------------------------------------------------------------------------------

        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

                lblDebugSelected.Text = lblDebugSelected.Text + myHiddenField.Value

        End Sub   'Page_Load

    Tuesday, July 9, 2019 6:38 PM