I tried to find all ids starting with the string "matchItem_" and define a click-event for each. onclick i want wo execute a script with a URL parameter and change the image in this id-element. Unfortunately my syntax isn't right, I also tried with .each.function but I didn't get it.
$('[id^="matchItem_"]').each {
    
    $(this).click(){
     //...execute my script.php?urlparam=xx....;
     $(this).find('img').attr('src','/admin/images/ok.png');
    }
}
                You don't need the each:
$('[id^="matchItem_"]').click(function() {
   // do something
   $(this).find('img').attr('src','/admin/images/ok.png');
});
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With