function test(id, val){ if(id == "location"){ handleLocationValues(val); } else if(id == "home"){ handleHomeValues(val); } ... ... }