You are doing the things in wrong way. $row1['id'] without <?php ?> it turn to be out only a string which is $row1['id'] and not an id from the loop. and another thing is your javascript selector is completely invalid , as it is outside of loop and it's not going to work at all. so better you follow the following code and make it possible in a better way.

Note again:

Your $row1['id'] is outside of while loop , so $row1['id'] is totally invalid and does not mean anything.

As you are targeting multiple files from the same page (let take an example that there are multiple elements and trigger for removing files connecting to same javascript function) You can use class selectors to get click event of multiple elements with same scope.