# Example usage of go.Figure.write\_html() function with post\_script parameter

**URL:** <https://community.plotly.com/t/example-usage-of-go-figure-write-html-function-with-post-script-parameter/46211>\
**Category:** 📊 Plotly Python\
**Created:** [October 19, 2020, 3:47pm UTC](https://community.plotly.com/t/example-usage-of-go-figure-write-html-function-with-post-script-parameter/46211 "2020-10-19T15:47:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mauro.grr](https://avatars.discourse-cdn.com/v4/letter/m/a4c791/32.png) [@mauro.grr](https://community.plotly.com/u/mauro.grr)\
**Post date:** [October 19, 2020, 3:47pm UTC](https://community.plotly.com/t/example-usage-of-go-figure-write-html-function-with-post-script-parameter/46211/1 "2020-10-19T15:47:21Z")

</div>

Since this is my first post in this forum, I would like to start be greeting everyone.

My (first) question is about a parameter of go.Figure.write\_html() function. In the function help, you can read about the post\_script parameter:

post\_script: str or list or None (default None)  
JavaScript snippet(s) to be included in the resulting div just after  
plot creation. The string(s) may include ‘{plot\_id}’ placeholders  
that will then be replaced by the `id` of the div element that the  
plotly.js figure is associated with. One application for this script  
is to install custom plotly.js event handlers.

I’ve found some examples of firing Javascript callback upon click on Plotly graphs events ([https://github.com/plotly/plotly.py/issues/1756](https://github.com/plotly/plotly.py/issues/1756)) but none of them show the usage of post\_script. Can anyone post an example or a link to an example of write\_html() with post\_script?

Thanks in advance

Mauro
