Why does the onclick event get this.src in js img without domain name?

function del (obj) {

console.log(obj.src);//srchttp
var img = document.getElementById("recommendimgs").value;
    var imgsArr = img.split(",");
    for(var i =0; i<imgsArr.length; iPP){
        console.log(imgsArr[i]);//http
        if(imgsArr[i]==obj.src){
            imgsArr.splice(i,1);
        }
    }
    var imgStr = imgsArr.join(",");
    document.getElementById("recommendimgs").value=imgStr;
    obj.parentNode.removeChild(obj);

}

now I want to match later and delete it. I want to know how onclick can get the src of the current picture without http, not to mention jq

Mar.01,2021

get the src attribute value directly:

console.log(obj.getAttribute('src'))

you can also remove the domain name of obj.src

console.log(obj.src.replace(/http[s]?:\/\/[^\/]+/,''))


take the value of this attribute when saving a src-source, fetch in the element

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e468ec-44bbc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e468ec-44bbc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?