As Ricardo mentions that still isn't grasped here

jQuery *is* JavaScript, but it's a framework on top to make things
easier

easier in all cases? heck no....  case in point

"So what's the best jQuery way to compare element values"

Why would there need to be a jQuery way?

object1.value == object2.value

would be the "best" way /*period*/ to compare values... there's no
need to complicate things by thinking "jQuery is better", because it
isn't in some, if not a lot, of cases

An example of the other direction (why jQuery would be "better") could
be had by opening up the full jQuery file and searching for "val:",
which shows an example of how jQuery makes life easy

$(object).val()

handles textboxes, selects, multi selected, and anything else that has
a valid "value" attribute available  (like for instance, you couldn't
say <span value="A113"></span> and expect it to work)

that would be a situation where jQuery makes life easy....

but just comparing "value a" to "value b", it doesn't get any easier/
better than JavaScript's native "==" operator


"It hadn't occurred
to me to look in the "Traversing" section of the docs."

If you're just starting out, just simply spending some time and
browsing the docs would be a great way to introduce yourself to what
the jQuery library is after  :-)


On Jan 20, 12:24 pm, fredriley <fred.ri...@gmail.com> wrote:
> On Jan 19, 4:28 pm, MorningZ <morni...@gmail.com> wrote:
>
> > If you look @ the document for ".is()"
>
> >http://docs.jquery.com/Traversing/is#expr
>
> Ah (light bulb goes off above head), now I get it. It hadn't occurred
> to me to look in the "Traversing" section of the docs. You really do
> have to internalise the mindset behind jQuery not only to work with it
> but even to be able to find your way around the docs which are rather
> different from API docs I'm used to (I know, it's not an API as such,
> but a framework).
>
> > and also (if you read the docs), .val():
>
> > ----------------------------------------------------
> > Get the content of the value attribute of the first matched element
> > ----------------------------------------------------
>
> > So it is not a jQuery object, hence you cannot do jQuery functions on
> > it....
>
> Figures. So what's the best jQuery way to compare element values, and
> are there comparative operators other than is()? There are comparative
> operators to find elements in the DOM hierarchy, but I can't see
> anything to compare values, or perhaps I should just use native
> Javascript operators.
>
> Thanks to both for the replies - appreciated.
>
> Cheers
>
> Fred

Reply via email to