That works, yes, but it would create a new jQuery object, defeating much of
the purpose of him creating 'obj' in the first place (memory and processing
time of creating new jQuery object).

As an aside, many devs find it useful to prefix vars for jQuery objects with
$.
e.g. var $obj = $("#test");

aquaone


On Thu, May 21, 2009 at 11:26, waseem sabjee <waseemsab...@gmail.com> wrote:

> There was no need to use find()
> $(function() {
> });
> would be required from jquery
>
> (".myclass", obj) is select my class from within my object ( no need to use
> .find() )
>
> <script>
> $(function() { // you need this
> var obj = ("#test"); // object refference
> $(".ajaxApplyIgnore ", obj).addClass("red"); // select the element in our
> refference
> }); // you need this
> </script>
>
>
> On Thu, May 21, 2009 at 8:11 PM, aquaone <aqua...@gmail.com> wrote:
>
>> $("test") should be $("#test").
>>
>> aquaone
>>
>>
>> On Wed, May 20, 2009 at 17:44, sean <shaha...@gmail.com> wrote:
>>
>>>
>>> I have the following code:
>>> <div id="test">
>>>  <div class="ajaxApplyIgnore">
>>>       <span><a href="javascript:ajaxApplyAll();" class="">Test1</a></
>>> span>
>>>  </div>
>>>  <div>
>>>    <span><a href="/Logout" class="">Logout</a></span>
>>>   </div>
>>> </div>
>>>
>>>
>>> <script>
>>> var obj = $('test'); // used specific div, as this is in a huge
>>> document
>>> obj.find('.ajaxApplyIgnore a').addClass('red');
>>> </script>
>>>
>>> The js code above will not select the Test1 link, even though it is
>>> found within the div layer with the ajaxApplyIgnore class. It seems
>>> that the selector does not work recursively.
>>>
>>> Does anybody know how to make the script work recursively this?
>>>
>>> NOTE: I am using Safari 3.
>>>
>>
>>
>

Reply via email to