Dominic Dominic - 1 year ago 91
jQuery Question

Appending Image Name that can show pop up when clicked

I am trying to append image name into a table cell. The image name (E.g. xxx.jpg), when clicked will show a pop up of the image, and can be closed.

Is this possible using Jquery alone?

Assume the directory for my image is 'http://myserver/project/images/'

function myfunction(response) {
var arr = JSON.parse(response);

if(arr.length == 0){
alert("Zero result found!");

else if (arr[0].count != 0){

for (i = 0; i < arr.length; i++) {

$("#questiondisplay").append("<tr><td>" + arr[i].question_id + "</td><td>" + arr[i].question + "</td><td class='my_image'>" + arr[i].image + "</td></tr>");


$('.my_image').click(function(){$(this).html(),null, "height=200,width=400,status=yes,toolbar=no,menubar=no,location=no");

<div id="questiondisplayarea">

<table data-role="table" id="questiontable">

<tbody id="questiondisplay">



Answer Source

Yes you can do this using JQuery:

1- On click event on the required element you can run


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download