Question

I'm trying to clear my MarkItUp editor. So far I've figured out how to put text in with the $.markItUp function, but I can't figure out how I'm supposed to clear the text box. I've tried just replaceWith: "", but I can't get all the text selected with javascript so that it is replaced by replaceWith. Also, if I try to replace it by setting the text inside of the textarea, the text shows up as blank in the text area, but not in the editor itself. Any help?

Here's what I'm using to insert the text:

        $.markItUp({
            openWith:"[quote="+data['username']+";"+postid+"]",
            closeWith:'[/quote]',
            placeHolder: data['content']
        });

I've tried:

$("textarea.bbcode-quickreply").text('');

This removes the text in the element, but the editor isn't affected.

Was it helpful?

Solution

You haven't given any sample code, so I had to assume things.

<script type="text/javascript">
    $(document).ready(function(e) {
        $("#someID").Click(function(event_parameter) {
            $("#someID").val("");
        });
    });
</script>
<textarea id="someID" name="someName"></textarea>

The above code will empty the textbox as soon as the user clicks on it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top