I am making a website with the flask module of python and facing issue in javascript of my html element and the error is in a on click event, when I click the button it shows an uncaught ReferenceError in console and it refers to copy of my webpage containing only a single onclick event statement and refering to the parameter I passed as undefined.
function add_card(id1, l_no){
var sec = document.getElementById(id1);
var inp1 = document.createElement("input");
inp1.setAttribute("placeholder","Enter a title");
inp1.setAttribute("id","inp1");
inp1.setAttribute("type","text");
var btn1 = document.createElement("button");
btn1.textContent = "Add card";
btn1.setAttribute("id","c_btn");
btn1.setAttribute("type","button");
btn1.setAttribute("onclick","card_done(l_no)");
sec.insertBefore(inp1,sec.lastElementChild);
sec.insertBefore(btn1,sec.lastElementChild);
}```
resulting error in console:
Uncaught ReferenceError: l_no is not defined
at HTMLButtonElement.onclick (1:1:11)
creating a copy file like this
[enter image description here](https://i.sstatic.net/KKRYg7Gy.png)
i checked the variable by printing it, there is no issue with the variable "l_no".
Please help finding the issue.