I can't seem to get a specific element by its class.
Here is the element:
<div id="getticketspecifictext-13827" class="ms-Panel-contentInner ms-Panel-tickets13827">
Here is the code. It fails at line 4 when trying to find the element in question:
const outputd = document.getElementById(paneltextinsert);
console.log(outputd)
console.log("ms-Panel-tickets" + ticketid)
var PanelExampleseditticket = document.getElementsByClassName(".ms-Panel-contentInner .ms-Panel-tickets" + ticketid);
console.log(PanelExampleseditticket)
PanelExampleeditticket = PanelExampleseditticket.querySelector(outputd.id);
console.log(editticketbutton.id)
console.log(PanelExampleeditticket)
var PanelExamplePaneleditticket = PanelExampleseditticket.querySelector(".freshdeskpanel");
console.log(PanelExamplePaneleditticket)
PanelExampleeditticket.addEventListener("click", function(i) {
new fabric['Panel'](PanelExamplePaneleditticket);
});
I tried also looking for just ms-Panel-tickets"+ticketid but it wouldn't find it even though if I printed the id it works perfectly.
EDIT: I tried taking out the space between the two classes I was looking for and that didn't work. Like so:
".ms-Panel-contentInner.ms-Panel-tickets"+ticketid
I also tried just using .ms-Panel-tickets"+ticketid as well and it still can't be found.
You don't use . when calling getElementByClassName. It should be more like this:
var PanelExampleseditticket = document.getElementsByClassName("ms-Panel-contentInner ms-Panel-tickets" + ticketid);