jquery attr with function code example
Example 1: jquery add attribute
$('#someid').attr('name', 'value');
Example 2: get attribute value jquery
var some_var = $( some_jquery_selector ).attr( 'some_attribute_name' );
$('#someid').attr('name', 'value');
var some_var = $( some_jquery_selector ).attr( 'some_attribute_name' );