In many divs I have to change the class name by replacing spaces with periods....
So I tried this
$(jqueryElements).each(function(index)
{
jqueryElements[index].className.replace(' ','.');
});
When the class has two words it works fine... But when the class name has 3 or more words it fails....
className='one word';
jqueryElement[index].className.replace(' ','.'); // console-> one.word
className='many many words';
jqueryElement[index].className.replace(' ','.'); // console-> many.many words
There is something wrong??
I'm using Chrome 25, Win7, jQuery 1.8
EDIT 2
I need to replace spaces to search all the span elements that have a particular class name.
So I use jquery in this way...
$('#span-container').find('span.'+jqueryElements[index].className.replace(' ','.').text('there are '+span_counter+'spans with this classname');
The result of this request shoud be:
$('#span-container').find('span.many.many.words).text('there are '+span_counter+'spans with this classname');
Instead I have:
$('#span-container').find('span.many.many words).text('there are '+span_counter+'spans with this classname');