i tried doing a loop but that doesn't exactly work
i thought of trying regex as well but that doesn't work either
this code is a part of a bigger that uses jquery to dynamically add fields when user presses add new and deletes those when user presses delete so the classes and ids used have a pattern they follow. ie. this will be solved if i can do $(like .'/deleteimg[0-9]{1,}/') instead of the exact thing.
the solution i have in mind right now is writing a code that writes this code but while that relieves me of writing the code it doesn't exactly help the code so i don't want to do that unless its the only option
ill be surprised if I'm the first person to ever run into this problem but googling didn't really reveal any relevant answers
jQuery(function($){
$('.deleteimg1').click(function() {
$('.1').remove();
});
});
jQuery(function($){
$('.deleteimg2').click(function() {
$('.2').remove();
});
});
jQuery(function($){
$('.deleteimg3').click(function() {
$('.3').remove();
});
});
jQuery(function($){
$('.deleteimg4').click(function() {
$('.4').remove();
});
});
jQuery(function($){
$('.deleteimg5').click(function() {
$('.5').remove();
});
});
jQuery(function($){
$('.deleteimg6').click(function() {
$('.6').remove();
});
});
jQuery(function($){
$('.deleteimg7').click(function() {
$('.7').remove();
});
});
jQuery(function($){
$('.deleteimg8').click(function() {
$('.8').remove();
});
});
jQuery(function($){
$('.deleteimg9').click(function() {
$('.9').remove();
});
});
jQuery(function($){
$('.deleteimg10').click(function() {
$('.10').remove();
});
});