I have a javascript file that I want to run after my display template has rendered. I have added it to my display template like so :

$includeLanguageScript(this.url, "~sitecollection/_catalogs/masterpage/Display Templates/Language Files/{Locale}/CustomStrings.js");
$includeScript(this.url, "~sitecollection/_catalogs/masterpage/Display Templates/Search/Customfeedbackinbox.js");

1 Answer 1


Display templates support OnPostRender event hanlder. You can invoke the JavaScript function using this

ctx.OnPostRender.push(ctx, function () {

An excellent article Useful JavaScript to know when working with SharePoint Display Templates

  • the same functionality can be achieved using this AddPostRenderCallback(ctx, function () { // do something });
    – jaku
    Commented Jun 11, 2015 at 8:00

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.