Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Object in inline onclick event

Why is this not working ?

<img id="xx" src="/Content/components/imgs/add.gif" onclick='ShowLookup({"id": "22","name": "Robert Pitt"})' />

or

<img id="xx" src="/Content/components/imgs/add.gif" onclick='ShowLookup("id": "22","name": "Robert Pitt")' />

When I click on the image I got an error: Invalid property id

like image 833
user256034 Avatar asked Dec 03 '25 18:12

user256034


1 Answers

Works like a charm for me :

http://jsfiddle.net/neebz/uwywG/1/

like image 169
neebz Avatar answered Dec 05 '25 08:12

neebz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!