improve js to toggle text in table view button