jQuery Text swap help
jQuery Text swap help
I am currently calling a function that checks if td contains a specific text, and if it does, it swaps the text with the array. Is there a better way I can do this? I have 165 to swap and append, and this could get lengthy.
- function replaceAff () {
- var RLREID = ["AL201","az202","az203","az204","ca202","ca203","ca204"];
- $('td:contains("' + 'al201_real_living_norman_realty' + '")').text(RLREID[0]);
- $('td:contains("' + 'az202_real_living_property_for_you' + '")').text(RLREID[1]);
- $('td:contains("' + 'az203_real_living_success_realty' + '")').text(RLREID[2]);
- $('td:contains("' + 'az204_real_living_s_j__fowler_real_estate' + '")').text(RLREID[3]);
- $('td:contains("' + 'ca202_real_living_college_realty' + '")').text(RLREID[4]);
- $('td:contains("' + 'ca203_real_living_sugar_pine_realty' + '")').text(RLREID[5]);
- $('td:contains("' + 'ca204_real_living_napolitano_real_estate' + '")').text(RLREID[6]);
- $('td:contains("' + 'ca205_real_living_properties_unlimited' + '")').text(RLREID[7]);
- });