JavaScript & HTML errors in SharePoint


I’m new to JavaScript and am trying to work through some errors. I’ve researched sites and made a few changes but still having trouble. Any assistance is appreciated. The goal is to take selected items on a SharePoint list and click a button that will open an email with list data. The errors are below:
SCRIPT1002: SCRIPT1002: HTML1423: Malformed start tag. Attributes should be separated by whitespace. HTML1409: Invalid attribute name character. Attribute names should not contain (“),(‘),(<), or (=). HTML1422: Malformed start tag. A self closing slash should be followed by a U+003E GREATER-THAN SIGN (>). HTML1423: Malformed start tag. Attributes should be separated by whitespace. Email.aspx (807,105) HTML1409: Invalid attribute name character. Attribute names should not contain (“),(‘),(<), or (=).

1st file...

<!DOCTYPE html>

<html lang=en>

<head>

<title>JavaScript sendemail.js</title>

</head>

<body>

<script src="https:.../jquery-1.12.4.js"></script> 

<script src="https:.../sprestlib.bundle.js"></script>

<script src="https:/.../jquery-3.5.1.js"></script>

<script src="https:.../email.js"></script>

<button onclick="clickMethod()">Send Email</button>

</body>

</html>



2nd file...

<script> 

 function clickMethod() {

  var ctx = SP.ClientContext.get_current();

  var items = SP.ListOperation.Selection.getSelectedItems(ctx);

    sprLib.list('DRLs').items({

    listCols: {

        iD: {dataName:'ID'},

        drlId: {dataName:'Title'},

        artifactIdCopy: {dataName:'ArtifactID'},

        assessmentId: {dataName:'AssessmentIDCopy'},

        dueDate: {dataName:'TaskDueDate'},

        AOREmails: {dataName:'AOREmails'},

        startDate: {dataName:'Assessment_x0020_ID_x0020_LU_x00'},

        teamMemberEmails: {dataName:'TeamMemberEmails'},

        artifactLink: {dataName:'Artifact_x0020_Link'},

        drlItemLink: {dataFunc:function(objItem){return '<a href="https://navsea.navy.deps.mil/hq/04/04I/PMOIT/IVV/TT/Lists/DRLs/DispForm.aspx?ID='+objItem.ID+'">View DRL</a>'}}

    },

    queryOrderby: 'Title';

    }) 

    .then(findSelectedItems(arrData, items);  // this is where we do stuff with the data returned by SharePoint.

    .catch(function(errMsg){console.error(errMsg) });  // error handling because reasons.

}

function findSelectedItems(spData, selectedItems){

    var emailBody = '';

    for(var i = 0; i < selectedItems.length; i++){

        var itemID = selectedItems(i).id;



        for(var j = 0; j < spData.length; j++){

            if (spData(i).iD == itemID){

                emailBody += "Title: " + spData(i).drlId + "rn";  // Add additional details to this line. Keep the rn at the end. It's a line break.

            }

        }

    }



    sendMail(emailBody);

}

function sendMail(bodyString) {

    var message = encodeURIComponent(bodyString);   // Outlook likes things to be URL-encoded. This line does that for you.

    //var yourMessage = document.getElementById('AORNames');    // not sure you'll need this, but it's here in case you do.

    var subject = document.getElementById('DRLID').value;

    var emails = document.getElementById('AOREMails').value;

    var mail = "mailto:" + emails + "?subject=" + subject + "&body=" + message;

    window.location.href = mail;    // new and improved command to open email client.

}

</script>
'''