Limit characters in SharePoint NoteField plus add a character counter

The other day we got a customer looking to make there ByLine/Ingress shorter than 255 charters. So we made a small jQuery script that looks at the “Ingress” field and then limit it to 160 characters. The script also count remaining characters. You probably find thousands of these scripts on the internet but i had a strange problem that i want to see if anyone could help me with?

Ill start by sharing the script with you and then move on to the issue at hand.

  • (I have added jQuery to the master page that i use.)
  • In my “ArticlePage.aspx” i had created custom field called Ingress (a NoteField to make it simpler to write an Ingress). In the code the filed name is “Ingress”.
  • Just to make it clearer… EditModePanel3 has the ID #ctl00_PlaceHolderMain_EditModePanel3_NoteField1_ctl00_TextField in the browser code….

The script/code is straight forward and easy follow….

Screen Shot 2013-11-25 at 12.55.17

OK, so now to the strange thing.

As i told you earlier i have loaded jQuery in the master page and it can see it get loaded when i edit this Article page… but the script don’t make use of the jQuery. (Nothing works)

My quick solution to this was to add jQuery to the “ArticlePage.aspx” as that got it working. But now i load jQuery twice. One time from my Local source and one time from google as you can see under here.

Any one that can tell me why i need to load it in the .aspx when it should be enough with the jQuery in the master page?


Leave a Reply

Your email address will not be published. Required fields are marked *