-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calendar does not trigger jQuery events #17515
Comments
@bembelimen why not: document.getElementById('jform_publish_down').addEventListener('change', function() { alert('test'); }); ?? This works in IE8 and all other browsers, so honestly I don't see a reason to mix jQuery when native javascript fulfils all our needs. Any particular reason why we need to care for jQuery's own events? |
Hi @dgt41 , Could you also say something about event delegation? (The reason for jQuery events is, that with vanilla JS, I have to implement a mapping for the events...) |
@bembelimen actually looking at the code I didn't see any code for triggering the change event, or I was too hurry. I guess if the event is triggered (vanilla or jQuery) will eventually bubble up to jQuery. Give me few days and I will come back with some more solid answers here |
@dgt41 any updates here? |
You can add the
Then in your JS:
|
Yeah, but I don't understand why there is no default implementation.... |
@bembelimen The calendar was a huge change, must have been missed out. |
@bembelimen @C-Lodder well it didn't exist in the old calendar and nobody ask for it during the testing period, but it's fairly simple to add a listener for an event, or dispatch an Event from the calendar. |
@dgt41 do you have any plans to implement it? That would be great! |
Is still still open? Any hint how to fix it? |
@coolcat-creations supporting jQuery events in 2020 is not very bright idea. It wasn't back in 2017... |
Events are events. Doesn't matter if they're called in jQuery or vanilla JS. |
The problem being is that the value is being set via Javascript, so the normal event listener don't apply. You can add a custom event: Add the following to Joomla's core calendar:
Then in your own code:
|
Comment #17515 (comment) |
please test #32756 |
closing as we have a pr #32756 |
Steps to reproduce the issue
You could use the console and insert:
jQuery('#jform_publish_down').on('change', function() { alert('test'); });
Expected result
The event will be triggered (=> alert test)
Actual result
No trigger
Additional comments
I'm not sure, why there is a vanilla JS calendar without any jQuery hooks in a system which relays on jQuery...
To check the event use:
jQuery('#jform_publish_down').trigger('change');
Delegation should probably work, too
The text was updated successfully, but these errors were encountered: