I want to pass parameters to onclick jquery function from html onclick event.
html statement rendering in PHP
$name = "abcd";
for ($i=0;$<10;$i++){
$text .= '<tr>
<td>'.$i.'</td>
<td><div id="name">'.$name.'/div>
<a class="href" onclick="callJSFunc($i,\''.$name.'\')" ></a>
</td>
</tr>';
}
javascript..
function callJSFunc(i , name){
alert(i+" "+name);
}
I want to convert it into someting...
$(".href").click(function(i,name,event){
alert(i+" "+name);
});
callJSFunc($iwill not insert the value of $i since you're using a single quoted string..