When you are coding in an aspx page you can do something like this:
<html>
<head>
<script type="text/javascript">
$(document).ready(function () {
var chkEnable = $get("<%= chkEnable.ClientID %>");
alert(chkEnable);
});
</script>
</head>
<body>
<form runat="server">
<asp:CheckBox ID="chkEnable" runat="server" />
</form>
</body>
</html>
But the only way I have found to use javascript in a web part is to use a ScriptLink that imports the file. Example:
<SharePoint:ScriptLink ID="ScriptLink5" runat="server" Name="myPorject/js/myCustomScript.js" Localizable="false" LoadAfterUI="true"/>
<asp:CheckBox ID="chkEnable" runat="server" />
Is there any way that I could reproduce the functionality from my first example in a web part? Anything that I do must be able to be installed entirely through a wsp onto a system that I have no other access to. Any solution must be implemented entirely through the wsp.