I'm making a custom autocomplete text field, how can I attach javascript events to my control?

  • Use the AddPostRender method to attach a function in which you can add your event listeners Jul 17, 2015 at 5:32

1 Answer 1


Take a look at this excellent article from Andrei Markeev: http://www.codeproject.com/Articles/610259/SharePoint-Client-Side-Rendering-List-Forms

In a nutshell:

  1. RegisterTemplateOverrides for OnPostRender. This will be called after rendering of each field on the form

  2. Use the ctx object (parameter to your OnPostRender method) to determine if it is called for your field (ctx.ListSchema.Field will give you field information)

  3. You can get the field control Id from the ctx and use it get the field control object and add the event handler to it in standard JS way


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.