Includes not working in custom script

when I put this line, the script stop working any ideia why??

If it’s a custom script, then it should be in javascript, which I don’t believe that is.

This has worked for me:

function loadjscssfile(filename, filetype){
    if (filetype=="js"){ //if filename is a external JavaScript file
        var fileref=document.createElement('script')
        fileref.setAttribute("src", filename)
    else if (filetype=="css"){ //if filename is an external CSS file
        var fileref=document.createElement("link")
        fileref.setAttribute("rel", "stylesheet")
        fileref.setAttribute("type", "text/css")
        fileref.setAttribute("href", filename)
    if (typeof fileref!="undefined")
loadjscssfile("/buying/doctype/purchase_common/purchase_common.js", "js");
1 Like