When calling $("#editor").bbcode("[b]bold[/b]"), bbcode(data) will call getHTML(data).
The getHTML function should return the corresponding HTML code of the data variable (which is BBCODE), but instead, because init is undefined and therefore not true, it will incorrectly return the current HTML value of the control instead of setting it as intended.
When calling $("#editor").bbcode("[b]bold[/b]"), bbcode(data) will call getHTML(data). The getHTML function should return the corresponding HTML code of the data variable (which is BBCODE), but instead, because init is undefined and therefore not true, it will incorrectly return the current HTML value of the control instead of setting it as intended.