Create a function to a function that runs a for loop?
<p>I have made some code that creates a red border around an image when the user click on to highlite thats the choosen one. But I want to erase previous or all border with a white border around all images before a new click is made on another image. My question is how do I activate a call to a function when a click is made and how would a function look in jQuery? I just whant to use the <code>.css</code> to change the border in perhaps a loop and change the id of the images? Can I mix common javascript with jQuery, or should it only be pure jQuery code in a script?</p>

<p>This is a simplified part of the code, it contains <code>"minibild_1"</code> to <code>"minibild_5"</code></p>

<pre><code>$(document).ready(function(){

$("#minibild_1").click(function(){
    $("#minibild_1").css({"border":"2px solid #D00C33"});
    $("#storbild").attr("src","../bilder/bilder_stora/{$row1-&gt;bild_1}.jpg");  
});

$("#minibild_2").click(function(){
    $("#minibild_2").css({"border":"2px solid #D00C33"});
    $("#storbild").attr("src","../bilder/bilder_stora/{$row1-&gt;bild_2}.jpg");   
});
});
</code></pre>
