Monday, June 24, 2013

jquery - Get file path of currently executing JavaScript code

scripts = document.getElementsByTagName("script");
$.each(scripts, function(i, v) {
    if (v.src.match("/sticky_note.js$")) {
        src = v.src.substring( 0, v.src.lastIndexOf( "/" ) ) + "/";
        console.log(src);
    }
});
scripts = document.getElementsByTagName("script");
$.each(scripts, function(i, v) {
    if (v.src.match("/sticky_note.js$")) { 
        src = v.src.substring( 0, v.src.lastIndexOf( "/" ) ) + "/";
        console.log(src);
    }
});

No comments:

Post a Comment