js attrs return from function