Jesper Christensen
asked on
jquery selector question
Hi.
I need to select the text "test", but cant figure it out :)
<div id="Price1">
<span id="SpecialOffer">122</spa n>
test
</div>
I´ve tried with :not, but dosent work.
I need to select the text "test", but cant figure it out :)
<div id="Price1">
<span id="SpecialOffer">122</spa
test
</div>
I´ve tried with :not, but dosent work.
ASKER
Well, If I want to hide the text or change the style, i cant use it as a var.?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hello Bongii,
Try with following code:
Try with following code:
function selectText(containerid) {
var div = document.getElementById(containerid);
var oldstring = div.innerHTML; // Stores Current text inside Div Tag
$(div).find('span').remove(); // Removes Span tag
alert(div.innerHTML); // display your required text 'test'
div.innerHTML = oldstring; // Restoring old value to div
}
Open in new window