Hi,

Apologies I'm new to jquery and javascript, the answer is probably
obvious but I have been staring at this for a while and while I have
something that works it seems a complete fudge. I was hoping someone
could point me in the right direction.

For a number of reasons I can't be certain of either class, name or id
of an input field (in a fieldset containing a number of inputs but
with one overall onblur), but need to check onblur to see if I need to
add another event specifically for this input based on a substring of
the id  or class.

the item concerned looks like this:
<input name="ctl05$url" type="text" id="ctl05_url" class="dyna-text
url" value="enter the bookmark url" />

The ctl05 part of the name/id can change and the class has dyna-text
added or removed also, so therefore in my action I want to check if
one of those values contains 'url'. I also know this input box is the
first in a set however wanted to avoid creating onblur specifically
for this (as like the other inputs has other onblur common
functionality for helptext etc.)

Anyhow I have managed trigger the specific event sucessfully within
the overall onblur function by the rather unwiedly (edited for
brevity):

$(".M12_editBookmarks fieldset input).blur(function()
{

Do general stuff

//Ugly!
if ($(this).attr("id") == $(".M12_editBookmarks fieldset
input:eq(0)").attr("id"))
{
 do specific stuff if matches
}

}

I tried all the options I could think of to get contains to work but
wasn't sure if this would work in this case i.e.:

if ($(this).attr("id:contains('url')"))
{
 do specific stuff if matches
}

&

if ($(this).attr("id).contains('url'))
{
 do specific stuff if matches
}

Can you use the contains option in such syntax (did I just get it
wrong), or is the wrong tool for the job?

Anyone point out the most likely blinding obvious? ;)

cheers

Pete


Reply via email to