I am trying to limit the length of the "Project Notes" Custom Field in Project Details Page (PDP) using Project Server 2010. I am using the following jQuery in a Content Editor Web Part added to the PDP:
<script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>
<script>
$(document).ready(function(){
var textArea = $("textarea[title$='Project Notes']");
textArea.keypress(function()
{
var text = textArea.text();
if(text.length > 10)
{
alert("Project Notes cannot exceed 100 characters in length.");
textArea.val(text.substring(0,9));
}
});
});
</script>
However, when the user types into the text area nothing is happening.The event does not fire. I have tried various modifications to the code but the same result. Please let me know what I am missing.
Thank you.