<asp:content id="HeaderContent" runat="server" contentplaceholderid="HeadContent">
</asp:content>
You should place your code AND YOUR JS FILES outside this holder in your master page. It's the holder of what you want only to be executed in the master page.
Second thing you have the choice, work with CssClass and $(".myClass") or IDs. If you work with IDs then you should check the Label1 ID if you run your project in a browser. When using Master Page it add something like "MainContent_" before the ID of your controls contained in child pages.