changed for loop to $.trim(modal)