How to efficiently change image attribute “src” from relative URL to absolute using jQuery?

后端 未结 8 718
旧巷少年郎
旧巷少年郎 2021-02-04 01:01

I need to change the src for an html image tag from relative to absolute url.

I am using the following code. urlRelative and urlAbsolute are created correct

8条回答
  •  清酒与你
    2021-02-04 01:21

    change image captcha refresh

    html:

      
    

    jquery:

    $("#captcha_img").click(function()
        {
            var capt_rand=Math.floor((Math.random() * 9999) + 1);
            $("#captcha_img").attr("src","http://localhost/captcha.php?" + capt_rand);
        });
    

提交回复
热议问题