0
Pass a parameter in javascript
Hello everyone.I have defined a function in js and I'm trying to pass a parameter to it in the click event of an img tag: <img onclick="RemovePic(@item.PicID)" src="~/Images/Galleries/@item.AcarModel.ModelName/@item.PicAddress" class="Image-Show" /> And the defintion of my function is: function RemovePic(id){} But my function doesnt get the parameter and id is always null
8 Respuestas
0
maryam mirzapoor your function name is "deletePic" and you write "RemovePic" on the img tag this is the reason!
0
Oh no its ok I wrote it right in my code and the function works but id is null
0
maryam mirzapoor then please send me your code, maybe bug some wherebinside your function!
0
Allright thx I will send it
0
Also, make sure you set the img tag a corresponse ID!
0
What you mean?
0
It's some thing like this:
<img id="ID" onclick="removePic(ID)" src="" >
0
Well I didnt set id at all but I have another element like this and it works