javascript - Altering attr string based on current attr value -
i have combo box listener expansion. upon expansion, performs styling on each element particular class within combo box options. 1 of desired changes alteration attribute based on current attribute's value. using this
returns undefined.
expand : function(combo) { $('.status-0').addclass('greyed-out'); $('.status-0').attr('attrname', $(this).attr('attrname') + ' status 0'); }
i'd each element .status-0
have attribute string have "is status 0" appended it. attribute extjs tooltip, solution should applicable attribute type.
you need use function
overload of $.attr
, accepts function
receive 2 parameters, index , attribute value. this
refer the element. don't need here since can use attribute's value passed.
$('.status-0').attr('attrname', function(_, attrval){ return attrval + ' status 0'; });
Comments
Post a Comment