Hi,

You could try this (untested):

$('[EMAIL PROTECTED]').each(
        function()
        {
                $this = $(this);
                if ($this.val() < 5) {
                        $this.addClass('S');
                } else if ($this.val() > 10) {
                        $this.addClass('L');
                } else {
                        $this.addClass('M');
                }
        }
);

Hope that helps,

Kelvin :)

Dug Falby wrote:
Hi all,

I'd like to do the following:

walk through the DOM stopping at:

[EMAIL PROTECTED]

and conditionally add a class to each input tag:

if [EMAIL PROTECTED]() < 5 then .addClass('S')
if [EMAIL PROTECTED]() > 10 then .addClass('L')
else .addClass('M')

Can I still use the lovely $() construct?

Thanks:-)
Dug

Reply via email to