I just tried dropped in some vanilla XML and it saves and renders
fine:
http://jsbin.com/uwedo/edit
I cleared out the JavaScript tab, and just entered plain old XML in
the HTML tab - the saved output is just XML:
http://jsbin.com/uwedo/
yeah! I couldn't manage to put xml in jsbin. I
You can use this syntax:
if ( $('#elementToBeUpdated').is('input,textarea') ) {
// use val();
} else {
// use text();
}
or you can take advantage of the empty return object (only one will
execute):
$('#element').filter('input,textarea').val(new);
@ricardobeat:
Great! thank you for your help. I see that there are plenty of manners
that can be used to retrieve the type of an element, now it's to
choose the good one ;) .
I'll use the ternary one for my code but I will also keep in mind the
other functions you gave here for using them in my
@ Balazs Endresz:
You're right, and Ricardobeat has given the good answer ;)
Even if i'm working with Firebug I didn't notice this behavior between
value and text.
@Remy:
yeah! I couldn't manage to put xml in jsbin. I followed the ajax video
without no success.
Any view where i pasted the xml
I met a similar issue, but i can determine it happens only with
Firefox (3.0.3).
The variable selector seems to be the problem.
I explained the whole thing here:http://jsbin.com/aciwi
in short,
$([id=' + variableId + ']).text( variableValue ); won't always
work with FF (it works in first steps)
In your case the proplem is that you're using .text() instead
of .value() on the textarea. The strangest thing is why does .text()
even work unless you change the content? It's quite misleading because
it shouldn't work on input elements: http://docs.jquery.com/Attributes/text
On Oct 18, 6:09
Slightly aside to your actual problem - I looked at the jsbin dump you
did and the source XML (http://jsbin.com/ebupo ) and noticed the XML
tags had been escaped - so I've gone in to the database and updated it
manually so your test page now works (or works in that it demonstrates
the problem).
At first, the textarea has 'text content' (inside the tags), and it's
shown inside. When you click the buttons, it updates this text
content.
*But*, when you edit it manually, you are updating the textarea's
VALUE attribute, not the the text inside. When you have both, the
value attribute
That looks like the proper syntax to get your desired selector. Are you
getting an error or unexpected results?
-- Josh
- Original Message -
From: Shadi Almosri [EMAIL PROTECTED]
To: jQuery (English) jquery-en@googlegroups.com
Sent: Monday, October 13, 2008 9:32 AM
Subject:
9 matches
Mail list logo