itzhaki
itzhaki

Reputation: 840

Manipulating google calendar DOM

I'm using jQuery to manipulate the Create Event view of Google Calendar.

I'm trying to set the start date&time as well as the end date&time via jQuery, but when actually creating the event it uses the default values instead of mine.

I'm guessing the required events are not being triggered.

I managed to get the date to work using: $('input[id$=-sd]').first().trigger('focus').val(startDate).blur()

But the time just doesn't get updated. Currently trying to use: $('input[id$=-st]').first().attr('value', startTime).val(startTime).trigger('change') But no luck.

Any ideas how can I imitate a user setting real input and then focusing out of the input element? :/

Upvotes: 0

Views: 315

Answers (1)

user1151899
user1151899

Reputation:

Try using vanilla Events instead of triggering jQuery events.

$('input[id$=-st]').first().attr('value', startTime).val(startTime)[0].dispatchEvent(new Event('change'))

I've found that I had similar issues when trying to use the jQuery .click() function in Google Calendar from a Chrome Extension.

Upvotes: 1

Related Questions