select custom field onchange

  • Posts: 48
  • Thank you received: 3
2 months 1 week ago #363120

-- HikaShop version -- : 5.1.1
-- Joomla version -- : 5.1.4
-- PHP version -- : 8.2

Hi
i have created a custom field of type dropdown
i was ablout to write a function to run on its onchange event, which i noticed hikashop dropdowns already has a onchange attribute with a function.

is there anyposibilities that i can add my function to the dropwon too ?

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
2 months 1 week ago #363122

Sure.
You don't need to add an onchange attribute to an element to get it to call your javascript code.
You can add an event listener:
developer.mozilla.org/en-US/docs/Web/API...get/addEventListener
Here is an example for the change event:
developer.mozilla.org/en-US/docs/Web/API...Element/change_event

Please Log in or Create an account to join the conversation.

Time to create page: 0.055 seconds
Powered by Kunena Forum