It works
http://jsfiddle.net/qo2ens33/2/
HTML
<span class="visibleText">Trying</span>
<div class="hiddenText"><span>to search</span></div>
<span class="visibleText">text</span>
CSS
.hiddenText{
width:0px;
height:0px;
overflow:hidden;
display:inline-block;
}
It works too
http://jsfiddle.net/ctwheels/qo2ens33/5/
HTML
<span class="visibleText">Trying</span>
<span class="hiddenText">to search</span>
<span class="visibleText">text</span>
CSS
.hiddenText {
position:absolute;
opacity:0;
width:0px;
}
Not sure if this is what you are looking for
Well, I think this is what you are looking for ... You cannot (as far as I know) look for two separate spaces together, so I did, I added visible spaces together
http://jsfiddle.net/ctwheels/qo2ens33/6/
Using this code:
Js
var numberOfElements = $(".visibleText").length;
for (var i = 1; i < numberOfElements; i++) {
$(".visibleText:eq(0)").append(" " + $(".visibleText:eq(1)").text());
$(".visibleText:eq(1)").remove();
}
source
share