make hyperlink from javascript

前端 未结 4 797
甜味超标
甜味超标 2020-12-06 08:52

I want to use a hyperlink string in HTML page which I want to declare source link (URL) in my js file. Please tell me how can I call that URL from my js into html.

T

4条回答
  •  萌比男神i
    2020-12-06 09:17

    From whatever I understand, You want to update href with JS variable. You can use Jquery to achieve it. try $("a").attr("href", js_variable) Refer this for more details How to change the href for a hyperlink using jQuery

提交回复
热议问题