The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript General (Easy) JS Question

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #168586

    Hello everyone:

    I have to deal with a JS problem, and want to get a better understanding of how JS works. I am not a sophisticated user, but I can read code to some extent and follow routines, handle some CSS, and so on.

    I have a forum which includes a number of bbcode buttons for posting, but I have just found out that the JS to support the buttons isn’t included. I have a bunch of php files with titles like parser and bbcode parser, and I can read all the templates telling me the names and so on of these buttons and the divs they are in, but (apparently) they need javascript power behind them.

    So basically I was told to get an implementation of bbcode in javascript, which there are plenty online. But I assume that I must “hook” the js script into my php files or templates, in other words, if the JS has a different file name then it wouldn’t work, isn’t that right? I have included the bbcode.js in my header list of scripts, but it still isn’t working, so I assume I have to link the two up, somehow.

    Could anybody shed some light on this situation? Where would I look for a call to the JS files, in the php or in the templates? How do these connect?

    Thanks in advance for any advice!


    Hi Shane thanks for the message.

    Yes, I think I figured it out, but let me bounce an idea or two off of you, if I may. It turned out the parser to change the code from bb to html was working fine, its just the buttons that aren’t working. I was a little unclear about that before.

    So I found that the buttons are using a function called surroundText, and I do have a working sample to inspect.

    So, if I have a call to a JS script in my header, (of any name) and that JS script properly defines the function called surroundText, am I good to go? Because this type of code is easy to find online.

    Thanks again for the help!


    Yes, as long as the JS file you add doesn’t have any dependencies or problems with any other script on the site :)


    Ah great! Thanks so much, I think I can avoid those two pitfalls! Cheers!~!

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.