I have function which gets the html generated in the iframe and replaces with custom tags.For eg.<b></b> tag is replaced with [b][/b]. likewise when i press tab key ,<span class="Apple-tab-span" style="white-space:pre"></span> is generated, how do i replace this with [tab][/tab] custom tag?.Please find the script which replaces bold tag, i tried replacing the whole span tag but it did not work.
Script:
function htmltoBBcode() {
var html = $("#textEditor").contents().find("body").html();
html = html.replace(/\</gi, '[');
html = html.replace(/\>/gi, ']');
$("#custom-tag").text(html);
}
Any help much appreciated. Jsfiddle: