I want to pass one tables id to a javascript. its working for the values 1,2,3,...
but the actual value i want to send is 001,002,003,....
But for these values its not working.
The value showing in console and getting in javascript function are as follows
001->1
002->2
.
.
009->9
010->8
011->9
012->10
.
.
php code is
<td> <a style="text-decoration:none; " href="#" onclick="updateCaste('.$rows['caste_code'].')" ><img src="prjct/edit-icon.png" width="20" height="20"> </a></td>
javascript code is
function updateCaste(x)
{
alert(x);
}
Plz somebody help me to solve this problem..
Put quotes around the value so it will be treated as a string, not a number:
<td> <a style="text-decoration:none; " href="#" onclick="updateCaste(\''.$rows['caste_code'].'\')" ><img src="prjct/edit-icon.png" width="20" height="20"> </a></td>