Title: texteditor promp
Post by: catpaw on February 21, 2017, 01:31:39 PM
hello I'm trying to capture the event focus and blur for texteditor but not good so far what I want is make promp function for texteditor $(function() { var default_promp = "Texto detallado de su solicitud..."; $('#te').on('blur', function () { var promp = $.trim($('#te').texteditor('getValue')); if(promp == ''){ $('#te').texteditor('setValue',default_promp); } }).on('focus', function () { var promp = $.trim($('#te').texteditor('getValue')); if(promp == default_promp){ $('#te').texteditor('setValue',''); } }); });
Title: Re: texteditor promp
Post by: jarry on February 21, 2017, 07:14:15 PM
The texteditor has no 'prompt' or 'placeholder' properties. A possible solution to add the prompt feature is to add a special background image instead of the prompt text. Please look at the code below: <style> .nocontent{ background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' version='1.1' height='50px' width='120px'><text x='0' y='15' fill='red' font-size='20'>Texto detallado de su solicitud...</text></svg>"); background-repeat: no-repeat;
} </style> <script type="text/javascript"> $(function(){ $('#te').on('keyup',function(e){ if ($(this).text()){ $(this).removeClass('nocontent'); } else { $(this).addClass('nocontent'); } }) }) </script>
|