Skip to content Skip to sidebar Skip to footer

Regular Expression Gives Different Output In Ff And Ie

My problem is that when I use this code: var queuediv = document.getElementById('MSO_ContentTable'); var total = get_text(queuediv); countTotal = total.split(/\s+/).length; this i

Solution 1:

You are splitting by white space characters (line breaks, tabs ...). These seems to vary in DOM representation of different browsers. I assume you are trying to split words. Try:

total.split(/ /).length;

or

total.replace(/\n\r\f/, '').split(/\s/).length

you may replace \v and \t also.

Post a Comment for "Regular Expression Gives Different Output In Ff And Ie"