sorry I'm really late to this thread, but it seems like my Text
Children plugin would help in this situation:
http://plugins.learningjquery.com/textchildren/
"The Text Children Plugin is a simple little jQuery plugin to return
textual content from selected elements. Unlike jQuery's built-
i
$('#testText').contents(':not(select)')[0].nodeValue;
$('#testText').contents('[nodeType=3]')[0].nodeValue;
I fear these aren't going to work in 1.3 as the new selector engine
doesn't handle textnodes anymore!
On Jan 15, 5:09 pm, kazuar wrote:
> thanks a lot ricardobeat.
>
> work like a charm :
thanks a lot ricardobeat.
work like a charm :)
ricardobeat wrote:
>
>
> There are two alternatives:
>
> $('#testText').contents(':not(select)')[0].nodeValue;
>
> this one is unsupported but works too:
>
> $('#testText').contents('[nodeType=3]')[0].nodeValue;
>
> Notice that both will kee
There are two alternatives:
$('#testText').contents(':not(select)')[0].nodeValue;
this one is unsupported but works too:
$('#testText').contents('[nodeType=3]')[0].nodeValue;
Notice that both will keep the linebreaks. if text() could handle
textnodes this would be much easier.
- ricardo
On J
Hi,
I thank you all for your help.
I guess I'll go with Bohdan's suggestion.
I'll put the text inside another tag (probably p tag...).
thanks again for all your help,
if you think of anything else please let me know.
Kazuar
Bohdan Ganicky wrote:
>
>
> Hello,
>
> maybe it could be easier t
Hello,
maybe it could be easier to use the good old DOM in this scenario:
var textNode = $('#testText').get().firstChild; // now we have the
textNode
var textRaw = textNode.nodeValue; // now we have the text string with
all the white-space around
var text = $.trim(textRaw); // we strip the trail
$("#testText").clone().remove('select').text()
won't work as the remove method doesn't remove the elements from the
jQuery object, just from the DOM. Here's how it should work:
var e = $("#testText").clone();
var select = e.find('select')[0];
e[0].removeChild(select);
alert( e.text() );
On Jan
This is quite tricky. I could not figure out how to get the text
(probably I should go home:) ).
If there is no other solution here is a dirty trick:
var tmp = $('#testText select');
//remove the select box
$('#testText select').remove();
// get the text within the div
var txt = $('#testText').t
anyone?
kazuar wrote:
>
> hello, Im kinda new in jquery so maybe its a begginer question.
> I have a page with a div containing some text and a combobox.
> something like that
>
>
> hello this is text and this is combobox
> 12 value='3'>3
>
> I wrote a function which return the text from
9 matches
Mail list logo