The problem you have with:
$("th").attr("aria-controls"="dog");
Is primarily that it's a syntax error (Uncaught ReferenceError: Invalid left-hand side in assignment); this is because there are two uses for the attr() method, getting or setting a value.
If you provide one argument it's a getter, and returns the value of the given attribute:
$('th').attr('aria-controls');
Will then return the value of the aria-controls attribute from the first/only element returnd by the $('th') collection of elements.
To set an attribute to a given value:
$('th').attr('aria-controls', 'aria-controls new value');
Which will set the attribute-value of the aria-controls attribute to the supplied value of 'aria-controls new value' (the second argument to the method).
You'll note that neither of these approaches uses the assignment (=) operator.
To find an element via its given attribute, and attribute-value, you need to use the attribute-equals ([attribute=attribute-value]) selector syntax from CSS:
$('th[aria-controls=dog]');