You can change the u attribute (incidentally, if you switch from u to data-u then it'll be a valid attribute, under HTML5):
$('img').attr('u', function(i,u) {
/* i is the index of the current image among all the images returned by the selector,
u is the current value of that attribute */
return u.slice(0, -1) + (parseInt(u.replace(/\D/g,''), 10) + 1);
});
JS Fiddle demo.
Though how the new value should be affected, by the loop or other variables, is unknown due to limited information in the question itself.
To demonstrate how to use the data-* attributes which allows custom attributes to be valid (under HTML5):
<img src="http://placekitten.com/400/500" class="className" click="" id='button4' data-u="button6" data-r="button5" data-l="ele1" data-d="" />
With the following jQuery:
$('img').attr('data-u', function (i, u) {
return u.replace(/\d+$/,'') + (parseInt(u.replace(/\D/g, ''), 10) + 1);
});
JS Fiddle demo.
With reference to answers posted in another question (Using a function to update a value within the data() method of jQuery sets the variable equivalent to the anonymous function, not the return value), the data() method doesn't accept a function as a callback, as attr() does, which is why I used the .attr('data-u', function(){/*...*/}) rather than the data() method itself (though I tried that first, which didn't work).
References:
$('img[u]').attr('u', '<new-value>')button7(or whatever) based on what, exactly?