Highlight bad words in textarea in php - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: General (https://forum.codeigniter.com/forumdisplay.php?fid=1) +--- Forum: Lounge (https://forum.codeigniter.com/forumdisplay.php?fid=3) +--- Thread: Highlight bad words in textarea in php (/showthread.php?tid=67770) |
Highlight bad words in textarea in php - wolfgang1983 - 04-07-2017 I have this function below which checks for bad words in callback. PHP Code: public function wordcheck() { On my function ask is there away that it can highlight bad word in my textarea? there is this http://garysieling.github.io/jquery-highlighttextarea/ but it is for javascript/jquery I would like to know if one for php/codeigniter available. PHP Code: public function ask() { RE: Highlight bad words in textarea in php - PaulD - 04-07-2017 Hi, You are going to have to do it with javascript as you cannot add markup within a text area without it becoming part of the text itself. The example library you linked to does not work on my browser. An interesting example approach to this is here: https://codepen.io/lonekorean/pen/gaLEMR You may be better changing the UI so that the user sees the block of text with words highlighted that are bad in a normal HTML panel, with the text area below. A little bit like how CI forum, when previewing a post, has the preview above and the text area below again. Best wishes, Paul. RE: Highlight bad words in textarea in php - wolfgang1983 - 04-07-2017 (04-07-2017, 05:23 AM)PaulD Wrote: Hi, Thanks for the reply PaulD I will look into it over weekend. |