In me html
I have an attribute onClick
and within it one función()
which I am passing two parameters, an integer and a string...
HTML
<span onClick="dataUser(3,admin);" style="cursor: pointer">Ver Usuario</span>
jQuery
function dataUser(p1,p2){
console.log(p2);
}
and the console throws me:
Uncaught ReferenceError: admin is not defined at HTMLButtonElement.onclick
What is this error due to? Does the function not receive string's?
If
admin
it is a text, it should be enclosed in quotes.Put single quotes:
You should send the admin parameter between ''. It should look like this: