Compute and edit multiple attributes in a single jQuery call -


i need compute new , edit both 'x' , 'y' attributes of svg element (rect) using single jquery call.

now know can this:

var incby = 20;  $('#test').attr('x', function(i, val) {     return parseint(val) + incby; }); 

which fine computing , editing single attributes, how can edit multiple attributes in way?

if factor out, can in 1 line:

$('#test').attr('x', myfunction).attr('y', myfunction);  function myfunction(i, val) {   return parseint(val) + incby;  } 

or abstract more , pass separate function attributes want apply to

process('x', 'y');  function process() {   (var = 0; < process.arguments.length; i++)     $('test').attr(process.arguments[i]), myfunction);    function myfunction(i, val) {     return parseint(val) + incby;    } } 

it depends on how far want go. include function called in parameters, , selection criteria too.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -