L
L
LoveCode &Coffe2018-08-02 02:57:48
JavaScript
LoveCode &Coffe, 2018-08-02 02:57:48

How to change the url address of a button link using js?

There is one button with a link to the page, how to change it through js? tried like this
Tried to give id to link : a id ="gotopay"
then in js

document.getElementById('gotopay').href ="http://site.ru/id=2"

but not working

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2018-08-02
@LoveCode &Coffe

but not working

Actually works: jsfiddle.net/bujvd9yr

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question