No announcement yet.

Problem with custom tag

  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with custom tag

    Hi to everybody.

    I'm using the spoiler tag provided on this board by a generous user.

    The code is:

    <input type="button" value="Spoiler" name="B1" onClick="alert('{param}')">

    Now, the problem is that this code would not regularly accept apostrophes. This has to do with the way alert boxes work, I reckon, and should be solved by placing \ in front of any apostrophe you want to show.

    By doing [spoiler]It\'s impossible[/spoiler] in the test space under the admin control panel, the code works correctly. In the regular forum, though, it doesn't. And I can't understand why.

    Thanks for any suggestion.

    Edit:Now I think I'm on to something... in the example above I've written It \ 's impossible, without spaces, but the \ doesn't show... why?

  • #2
    Because it is javascript and what you are doing is called "escaping". If you didn't use the \ then the ' would close the string and cause errors.
    Translations provided by Google.

    Wayne Luke
    The Rabid Badger - a vBulletin Cloud demonstration site.
    vBulletin 5 API - Full / Mobile
    Vote for your favorite feature requests and the bugs you want to see fixed.


    • #3
      Yes, but why on the Admin Panel it tests correctly and then it doesn't work on the forum? Is there a way to solve this?


      • #4
        Sorry... but... anybody else who could help me?


        • #5
          Listen, I admit that I'm ignorant in this regard... but could somebody please explain me why the above does work in the admin control panel and then doesn't in the regular forum? What's the point of having a test space in the CP when it doesn't faithfully reproduce the behavior of the forum?