Add onclick to element, but keep current onclick event

SolidSnake

Is it possible to add a javascript event to a DOM element that already has a onclick event, but I want to keep that event property.

I have radio buttons like this:

<input type="radio" name="checkout-payment" value="56" id="checkout-payment-56" class="checkout-radio checkout-payment-radio checkout-payment-radio" onclick="paymentChanged(this);" />

in which I want to add

window.location.href=window.location.href

while keeping the original onclick, but I have no access to the html, I can only modify through javascript.

so my desired code will be

<input type="radio" name="checkout-payment" value="56" id="checkout-payment-56" class="checkout-radio checkout-payment-radio checkout-payment-radio" onclick="paymentChanged(this); window.location.href=window.location.href" />
SolidSnake

I actually found out there was a much simpler way to acheive my desired result.

    $( '.webshop-checkout input[type="radio"]' ).click(function() {
  location.reload(true);
});

i am sorry i was not clear in my original post, and it has been edited.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Set current element in onclick event handler loop

From Dev

Current element reference inside onclick event jQuery

From Dev

How to add a onclick event to an element using javascript

From Dev

onclick event on <audio> element

From Dev

Add an onClick event to append()

From Dev

How to add an onclick event to a joint.js element?

From Dev

Easy way to add image to a element on a onclick event javascript

From Dev

Attaching onclick event to element is not working

From Dev

Creating a targeted onclick event with element

From Dev

Attaching onclick event to element is not working

From Dev

onclick event not working for svg element

From Dev

Add dynamic variable to onclick event

From Dev

Add onclick event via JavaScript

From Dev

Add dynamic variable to onclick event

From Dev

Reverse onClick Event onClick

From Dev

How to clear onClick before add new onClick event?

From Dev

how to attach onclick event to XTemplate element extjs?

From Dev

Dynamically create onclick event anchor element - javascript

From Dev

Check the form element triggered at onclick event

From Dev

Why is the onclick event on the body element not working?

From Dev

How to get element assoicated to onClick event

From Dev

JS element onclick event not being fired

From Dev

Why is the onclick event on the body element not working?

From Dev

Dynamically create onclick event anchor element - javascript

From Dev

Send onclick event of element without id

From Dev

onClick event on an array element javascript React

From Dev

How to find a td element that contains a h1 and then add an onclick event to the td

From Dev

add a onclick event to audio timeline with jquery

From Dev

Add serverside onclick event to programmatically created div

Related Related

  1. 1

    Set current element in onclick event handler loop

  2. 2

    Current element reference inside onclick event jQuery

  3. 3

    How to add a onclick event to an element using javascript

  4. 4

    onclick event on <audio> element

  5. 5

    Add an onClick event to append()

  6. 6

    How to add an onclick event to a joint.js element?

  7. 7

    Easy way to add image to a element on a onclick event javascript

  8. 8

    Attaching onclick event to element is not working

  9. 9

    Creating a targeted onclick event with element

  10. 10

    Attaching onclick event to element is not working

  11. 11

    onclick event not working for svg element

  12. 12

    Add dynamic variable to onclick event

  13. 13

    Add onclick event via JavaScript

  14. 14

    Add dynamic variable to onclick event

  15. 15

    Reverse onClick Event onClick

  16. 16

    How to clear onClick before add new onClick event?

  17. 17

    how to attach onclick event to XTemplate element extjs?

  18. 18

    Dynamically create onclick event anchor element - javascript

  19. 19

    Check the form element triggered at onclick event

  20. 20

    Why is the onclick event on the body element not working?

  21. 21

    How to get element assoicated to onClick event

  22. 22

    JS element onclick event not being fired

  23. 23

    Why is the onclick event on the body element not working?

  24. 24

    Dynamically create onclick event anchor element - javascript

  25. 25

    Send onclick event of element without id

  26. 26

    onClick event on an array element javascript React

  27. 27

    How to find a td element that contains a h1 and then add an onclick event to the td

  28. 28

    add a onclick event to audio timeline with jquery

  29. 29

    Add serverside onclick event to programmatically created div

HotTag

Archive