Home › Forums › JavaScript › General (Easy) JS Question
- This topic is empty.
-
AuthorPosts
-
April 24, 2014 at 8:17 am #168586
nuan
ParticipantHello 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!
April 24, 2014 at 10:54 pm #168644nuan
ParticipantHi 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!
April 24, 2014 at 11:03 pm #168646shaneisme
ParticipantYes, as long as the JS file you add doesn’t have any dependencies or problems with any other script on the site :)
April 24, 2014 at 11:50 pm #168649nuan
ParticipantAh great! Thanks so much, I think I can avoid those two pitfalls! Cheers!~!
-
AuthorPosts
- The forum ‘JavaScript’ is closed to new topics and replies.