Iam using framework 7 and have been trying to embed JavaScript chat script by converting to jquery the problem is that framework 7 does not accept on click function in pure JavaScript
<div class="uRow" id="usr<?=$uid?>" onclick="msg.show(<?=$uid?>)"> <div class="uName"><?=$u["user_name"]?></div> <div class="uUnread"><?=isset($u["unread"])?$u["unread"]:0?></div> </div>
It shows this error = msg not defined, So what i have been trying to do is to convert the entire javascript code to jquery
So my problem is to change this div class function to jquery function and make it to match the jquery code .
So I have try to use this method I found on the internet
<div id="myDiv">Some Content</div>
$('#myDiv').click(divFunction);
function divFunction(){
//some code
}
but get stuck on how to include the php values
to jquery but cannot figure how to go on about it. I am in need of assistance please
Here is my script
var msg = {
// (B) SHOW MESSAGES
uid : null, // current selected user
show : uid => {
// (B1) SET SELECTED USER ID
msg.uid = uid;
// (B2) GET HTML ELEMENTS
let hForm = document.getElementById("uSend"),
hTxt = document.getElementById("mTxt"),
hUnread = document.querySelector(`#usr${uid} .uUnread`),
hMsg = document.getElementById("uMsg");
// (B3) SET SELECTED USER
for (let r of document.querySelectorAll(".uRow")) {
if (r.id=="usr"+uid) { r.classList.add("now"); }
else { r.classList.remove("now"); }
}
},
};
`