andyd34 Posted September 22, 2009 Share Posted September 22, 2009 I am using the following to format text within an iframe/text area function formatText(iframe, command, option) { iframe.contentWindow.focus(); try { iframe.focus(); iframe.document.execCommand(command, false, option); iframe.focus(); } catch (e) { } } most things work fine when called $('.bold', tb).click(function(){ formatText(iframe, 'bold');return false; }); $('.italic', tb).click(function(){ formatText(iframe, 'italic');return false; }); $('.underline', tb).click(function(){ formatText(iframe, 'underline');return false; }); $('.$class_name', tb).click(function(){ formatText(iframe, 'InsertImage', '$url/$image'); except "$('.color_$key', tb).click(function(){ formatText(iframe, 'ForeColor', '#666'); Does anyone have any suggestions Link to comment https://forums.phpfreaks.com/topic/175161-execcommand/ Share on other sites More sharing options...
andyd34 Posted September 24, 2009 Author Share Posted September 24, 2009 Sorted now, just added return false to the string "$('.color_$key', tb).click(function(){ formatText(iframe, 'ForeColor', '#666'); return false; Link to comment https://forums.phpfreaks.com/topic/175161-execcommand/#findComment-924497 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.