You can also specify a static ID for the field in your aspx and use code
behind to affect its behaviour, which I'd recommend.

Using jQuery wildcards like the one above can become very problematic if
other controls exist or need to be added later.

If you HAVE to use jQuery then I would lock-down the order of the
control(s) within the page rendering structure and target it using pseudo
selectors such nth-child.

Regards,

Paul


On 3 July 2013 13:27, Ajay <[email protected]> wrote:

> Thanks Guys,
>
> $("[id$=ddlComponents]") looks great... Will try this soon... big relief
>
> Cheers
> Ajay
>
>
> On Wed, Jul 3, 2013 at 2:44 PM, Matthew Cosier <[email protected]> wrote:
>
>> That "gibberish" is the construction of the client ID for the element
>> which is constructed using the hierarchy of the control on the page.
>>
>>
>>
>> You need to be less specific with your jQuery selector.  You can do this
>> using wildcard selectors:
>>
>> $("[id$=ddlComponents]")
>>
>>
>>
>> This will select the element where the id ends with ddlComponents, that
>> way if you change the location of this control on your page, your script
>> will still function.
>>
>>
>>
>> Cheers,
>>
>>
>>
>> *Matthew Cosier | *Hazaa Pty Ltd |  *m: *+61 428 322 904* | e: *matt*@*
>> hazaa.com.au <[email protected]>* | w: *http://www.hazaa.com.au
>>
>>
>> On Wed, Jul 3, 2013 at 12:16 PM, Ajay <[email protected]> wrote:
>>
>>> Hi Guys,
>>> I am creating a custom user control in MOSS 2007 to save some values to
>>> database.
>>>
>>> I am seeing the tags have changed because of masterpage..and affected
>>> Jquery code
>>>
>>> Dropdown id was ddlComponents, it changed to
>>> #ctl00_m_g_97d0d488_aa17_4761_a330_12496d50c779_ctl00_ddlComponents
>>>
>>> I have changed this and Jquery is working fine...
>>>
>>> When we deploy to Test environment, will this gibberish -
>>> ctl00_m_g_97d0d488_aa17_4761_a330_12496d50c779_ctl00_- change again...
>>>
>>>
>>>
>>> Cheers
>>> A
>>>
>>>
>>>
>>> _______________________________________________
>>> ozmoss mailing list
>>> [email protected]
>>> http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss
>>>
>>>
>>
>> _______________________________________________
>> ozmoss mailing list
>> [email protected]
>> http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss
>>
>>
>
> _______________________________________________
> ozmoss mailing list
> [email protected]
> http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss
>
>
_______________________________________________
ozmoss mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss

Reply via email to