Reputation: 5029
I have a textarea bound as below
<textarea id="markdownEntry" class="w-100 h-100" bind="@MarkdownContent"
@bind-value="MarkdownContent"
@bind-value:event="oninput"
placeholder="Enter markdown here..."></textarea>
but I would like the oninput to fire when the value of the text area is updated with javascript as well (needed to create a editor) I tried the following js but doesnt seem to work
function forceUpdate(input) {
var event = new Event('input');
input.dispatchEvent(event);
}
I also tried changing input
to change
Upvotes: 2
Views: 2088
Reputation: 5029
function forceUpdate(input) {
var event = new Event('input', {
'bubbles': true,
'cancelable': true
});
input.dispatchEvent(event);
}
Fixed the issue
Upvotes: 3