Div call function
I do this: <div onclick='alert("xxx")'>Click me!</div>and I see this warning, but I want to call a function inside this onclick. I am trying to do this, but it does not work.
function GetContent(prm){
alert(prm);
}
<div onclick='GetContent("xxx")'>Click me!</div>
I need to call this inline function so as not to assign an id or class to this div and use jquery. What's the solution? Thanks
Using code inlineis bad practice, you need to assign IDeither Classdiv and call functions, for example:
<div class="test">Click me!</div>
$('div.test').click(function(){
GetContent("xxx");
});
.
I need to call this inline function not to assign an id or class to this div and use jquery.
I think you are already doing this with this code:
<div onclick='GetContent("xxx")'>Click me!</div>
inline id . , , .