Use $("div.myclass.which.contains.blanks.img")
$("div.myclass.which.contains.blanks.img").setAttribute('width', '200px');
You can also add style attribute
$("div.myclass.which.contains.blanks.img").style.width = "200px";
$("div.myclass.which.contains.blanks.img").style.height = "200px";
On Tue, Apr 3, 2012 at 15:59, Tei <[email protected]> wrote:
> On 3 April 2012 09:29, Ben Stover <[email protected]> wrote:
>> Interesting. However my initial post contained only a simplified version of
>> the scenario.
>> The more detailed version looks like this:
>>
>> <div class="myclass which contains blanks">
>> <a name="navi" title="" href="http://www.someurl.com/">
>> <img title="mylogo" alt=... src=...>
>> </a>
>> </div>
>
> I am not sure I understand... "Hello world" is not 1 class, is 2
> class: "hello" and "world". The whitespace act a separator.
>
>
>>
>> So if I code now:
>>
>> $("div.myclass which contains blanks img").setAttribute('width', '200px');
>> $("div.myclass which contains blanks img").setAttribute('height', '40px');
>>
>> it does not work.
>>
>
> I don't think you can use setAttribute with a jquery object.
> setAttribute is a method for normal HTML nodes. The equivalent for
> jquery is attr. $(something).attr("width",'200px');
>
> Use the Firebug console to test different qualifiers until you get it
> right. Probably "div.myclass which contains blanks img" is not right.
> In the firebug console you can try to execute $("div.myclass which
> contains blanks img") and see if it loads the node you want or
> something else, or nothing. With the html you provide, sounds like
> something like this may work $("div.myclass img[title=mylogo]") but
> perhaps you can abuse the src for a more reliable result
> $("div.myclass img[src=logo1.gif]")... I have not tried this (can be
> wrong).
>
>
>
>
> --
> --
> ℱin del ℳensaje.
>
> --
> You received this message because you are subscribed to the Google Groups
> "greasemonkey-users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/greasemonkey-users?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"greasemonkey-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/greasemonkey-users?hl=en.