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').text();
// put back the selectbox
$('#testText').append(tmp);


-------------
Read jQuery HowTo Resource  -  http://jquery-howto.blogspot.com



On Mon, Jan 12, 2009 at 7:01 PM, kazuar <kazuar...@gmail.com> wrote:
>
>
> 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
>>
>> <div id="testText">
>>  hello this is text and this is combobox
>>  <select><option value='1'>1</option><option value='2'>2</option><option
>> value='3'>3</option></select></div>
>>
>> I wrote a function which return the text from the div.
>>
>> alert($('#testText').text());
>>
>> My problem is  that the function also return the text inside the combobox.
>> is there a way to filter out the combobox text?
>>
>> the only workaround I can think of is to wrap my text in another div and
>> call its text.
>> This workaround will be a bit complicated for me because the text on my
>> page is dynamic and it can come after the input field or before the input
>> field so I just want to get the text inside the div without the input
>> fields text... (This only happens with combobox).
>>
>> tnx,
>> Kazuar
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/function-text%28%29-in-jquery-tp21410667s27240p21414973.html
> Sent from the jQuery General Discussion mailing list archive at Nabble.com.
>
>

Reply via email to