Reputation: 215
i am developing chrome extension in google calendar. The description of the meeting is updated through jquery as shown below,
<div class="ui-sch">
<textarea id=":24" name=":24" class="textinput" style="overflow: hidden; resize: vertical;" rows="3" aria-labelledby=":13.descript-label">
</textarea>
</div>
var el= document.getElementsByClassName("textinput");
for(i=0; i < el.length; i++)
{
if(el[i].type == "textarea")
{
el[i].value="sample description";
}
}
The content gets updated to the textarea as expected. but when we submit the form, the description is not submitted. Where as if we manually press enter after updating the content, the updated value from javascript is submitted.
I suspect, the data change in description box is binded to another variable. How to update the data change in desc to the form submission ?
update : Steps to simulate
Now click save (the meeting description will not be saved if you open the meeting)
Now create a meeting and follow the above steps 1-3.
Upvotes: 1
Views: 93
Reputation: 6682
In your example page, it seems as the Google API only recognizes changes when it listens a change
event. You can simulate it by
el[i].dispatchEvent(new Event('change'));
Upvotes: 2
Reputation: 206
not verified, just a suggestion:
if(el[i].type == "textarea")
{
el[i].value="sample description";
el[i].onchange();
}
Upvotes: 0