Skip to content Skip to sidebar Skip to footer

Return The Split Path If The Json Attribute Exists Else Return Blank

I need to display the name and split path of the path entered by a user dynamically. For that, I had split the path entered by the user and grab only certain part of it. For e.g. i

Solution 1:

OK, I got it. I tried this and it worked! Also, in the function I just wrote 'text(imgPath)'.

if(imgPath){
    imgPath = imgPath.match(/portraits\/.*$/i);
} else {
    imgPath = "";
}

Post a Comment for "Return The Split Path If The Json Attribute Exists Else Return Blank"