problem with click event jquery
<p>i'm sure that's silly thing but id don't know what i'm doing wrong</p>

<p>i have a method that create's a table into a panel asp with some element's. Also i have two events, hover and click the hover works great  too, but css that i need to set in the element don't appears when the even it's click. what i'm doing wrong bucause i put a alert in the function and works fine. thanks for your time mi code below.</p>

<pre><code>function buildImageGallery(data) {

//boring code
$(".pnlImage tr").remove();
var tableSelector = '&lt;table class="tableFinder" id="imageSelectorPanel"&gt;';
tableSelector = tableSelector + '&lt;tr&gt;';
var imagesData = data.d.split(";");
for (var i = 0; i &lt; imagesData.length; i++) {
    if (i != imagesData.length - 1) {
        var image = imagesData[i].split(",");
        tableSelector = tableSelector + '&lt;td&gt;' + '&lt;div id="' + image[0] + '" '
            + 'class="imagePanel" style="background:url(' + image[1]
            + ');background-repeat:no-repeat;margin-left:auto;margin-right:auto;margin-top:auto;margin-bottom:auto;"&gt;' + "&lt;/div&gt;" + "&lt;/td&gt;";
    }
}

tableSelector = tableSelector + '&lt;/tr&gt;';
tableSelector = tableSelector + '&lt;/table&gt;';
$(".pnlImage").append(tableSelector);
//the two events
$(".imagePanel").hover(mouseOver, mouseOut);
$(".imagePanel").click(setElement);
}

function mouseOver() {
$(this).stop(true, true).animate({
    opacity: 0.25
}, 100, function () {
    $(this).css('border', '2px solid black');
});
}

function mouseOut() {
$(this).stop(true, true).css('border', '0 none').animate({
    opacity: 1
}, 100);
}
//this method executes but don't add the style
function setElement() {
//    alert("click the element with id: " + this.id);
$(this).css('border', '2px solid black');

}
</code></pre>
