MyBB Community Forums

Full Version: custom mycode not working in mybb, but everywhere else
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
If i run this in a test html file it works as expected. In fact it works in jsfiddle
https://jsfiddle.net/fy452ct3/3/


<style>
.spoilerbutton123[value="Show"] + .spoiler123 > div {margin-top:-100%;}
</style>
<input class="spoilerbutton123"  type="button" value="Show"  onclick="this.value=this.value=='Show'?'Hide':'Show';">

<div class="spoiler123"><div>
$1
</div></div>

when i add this as the replacement though in a custom mycode, for a regex of something like
\[test\](.*?)\[/test\]
It shows the hidden text all the time, while the button toggles as expected. 


Why does the text show all the time only in mybb, but toggles everywhere else?

Ive tried various methods to hide text in the spoiler123 section but to no avail
Here's my untested guess: in both of the thumbnails that you show, you are putting a line break before and after tester, and your regular expression is not set up to deal with line breaks. I'd do everything on one line. If you want to accommodate line breaks, then I think you need to use ([\s\S]*) instead of (.*).