I am using the following code to toggle. But somehow it does not work. The reason I found is it does not support special characters like : ~ in the Id reference. Is there any workaround to fix this issue.
Note: I cannot change the Id name as it is system generated.
<!DOCTYPE html>
<html>
<head>
<script>
$(document).ready(function(){
$("button").click(function(){
$("#d:dashboard~p:k1s87ca25ol4e0b7~s:kfld0kqbros586fm").toggle();
});
});
</script>
</head>
<body>
<button>Toggle</button>
<p id="d:dashboard~p:k1s87ca25ol4e0b7~s:kfld0kqbros586fm">This is a paragraph with little content.</p>
<p>This is another small paragraph.</p>
</body>
</html>