Added JavaScript method to return the active item