I find myself using this frequently...
Another helpful tip is to:
this.txtProjectName = $('#<%=this.txtProjectName.ClientID %>');
...this will ensure that txtProjectName
is a jQuery object right from the start.
Check out this detailed example:
Please keep in mind that some of the calls in the class referenced below are connected to objects not visible here.
<script type="text/javascript">
var projectDialog = (function($) {
var publicInstances = {};
// ***********************
// form
publicInstances.form = form;
function form(controller) {
/// <summary></summary>
var self = this;
/// <summary></summary>
this.controller = controller;
/// <summary></summary>
this.validationController = null;
// more properties...
/// <summary></summary>
this.initialize = function() {
// initialization logic
};
// more methods...
};
return publicInstances;
})(jQuery);
</script>