I know the following jquery syntax will set the attribute value for src
$(this).closest('img.button').attr('src', '/images/button.png');
But how can I get or grab the 'src' attribute's value for use in my jQuery script?
The same way, just don't provide the second parameter.
$(this).closest('img.button').attr('src');
If you provide only one parameter, .attr(...) acts as a getter.
If you provide two parameters, then .attr(...) acts as a setter.
If you want to remove the value, later, you would do:
$(this).closest('img.button').removeAttr('src');
Here is a link to the jQuery documentation for $.attr().
attr is getter and setter function. Docs here: http://api.jquery.com/attr/
Get attribute:
$(this).closest('img.button').attr('src');
Set attribute:
$(this).closest('img.button').attr('src', '/images/button.png');