I’m trying to reset and clear a richtext editor field once I click a button on a form and so far I’m not having any success.
Here is the form with the richtext editor. The button used to reset the form is bolded below:
<div class="verticalspace"></div>
<div class="form-group col-md-8 col-lg-4">
<label class="control-label">Display Order</label>
<div><input id="displayOrder" asp-for="DisplayOrder" name="displayorder" class="form-control" /></div>
</div>
<div class="verticalspace"></div>
<div class="form-group col-md-8 col-lg-4">
<label class="control-label">Status</label>
<div>
<select asp-for="StatusId"
asp-items="Model.AvailableStatuses" class="form-control"></select>
</div>
</div>
<div class="verticalspace"></div>
<div class="verticalspace"></div>
<div class="verticalspace"></div>
<div class="verticalspace"></div>
<div class="form-group col-md-8 col-lg-12">
<label class="control-label">Description</label>
<textarea class="rtextDescription" name="Description" id="Description" row="1" cols="60"
data-val-maxlength-max="200" asp-for="Description"
data-val-maxlength="Max length for Description is 200"></textarea>
</div>
<div class="verticalspace"></div>
<div class="verticalspace"></div>
<div class="form-group col-md-12">
**<input id="dor-item-save-and-add-another"**
** type="button"**
** value="Add & Create Another"**
** class="btn btn-forum col-sm-12 col-md-4 col-lg-4" />**
<input id="dor-item-submit"
type="button"
value="Add & Return to Exam"
class="btn btn-forum col-sm-12 col-lg-4 col-md-4" />
</div>
Add & Create Another is the button to reset the form
JS file:
jQuery.fn.reset = function () {
$("#CategoryId").prop('selectedIndex', 0);
$("#StatusId").prop('selectedIndex', 0);
**$(".rtextDescription").jqteVal('');**
$("#displayOrder").val(0);
}
This is the part I need help with that is not working.