8000 adding a JavaScript/Jinja example to dropdowns.md by rl-utility-man · Pull Request #4886 · plotly/plotly.py · GitHub
[go: up one dir, main page]

Skip to content

adding a JavaScript/Jinja example to dropdowns.md #4886

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Dec 16, 2024
Prev Previous commit
Next Next commit
replacing HTML markup with escaped characters
  • Loading branch information
rl-utility-man authored Dec 3, 2024
commit 9af87c95188b7f00215d946358ee5711f8f729f9
36 changes: 19 additions & 17 deletions doc/python/dropdowns.md
Original file line number Diff line number Diff line change
Expand Up @@ -504,38 +504,40 @@ with open(output_html_path, "w", encoding='utf-8') as output_file:

#### Jinja HTML Template

<!-- #region -->

```
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

</head>
<body>
<div class="container">
<h1>Select an analysis</h1>
<select id="dropdown" class="form-control">
&lt;!DOCTYPE html&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
&lt;meta charset="UTF-8"&gt;

&lt;/head&gt;
&lt;body&gt;
&lt;div class="container"&gt;
&lt;h1&gt;Select an analysis&lt;/h1&gt;
&lt;select id="dropdown" class="form-control"&gt;
{{ dropdown_entries }}
</select>
&lt;/select&gt;


{{ divs }}

</div>
&lt;/div&gt;

<script>
&lt;script&gt;
document.getElementById('dropdown').addEventListener('change', function() {
const divs = document.querySelectorAll('.content-div');
divs.forEach(div => div.style.display = 'none');
divs.forEach(div =&gt; div.style.display = 'none');

const selectedDiv = document.getElementById(this.value);
if (selectedDiv) {
selectedDiv.style.display = 'block';
}
});
</script>
</body>
</html>
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
```


Expand Down
0