Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #19392

Re: Based on its src value, find an image and assign an ID?

From Stefan Weiss <krewecherl@gmail.com>
Newsgroups comp.lang.javascript
Subject Re: Based on its src value, find an image and assign an ID?
Date 2013-04-21 00:52 +0200
Organization albasani.net
Message-ID <kkv679$ici$1@news.albasani.net> (permalink)
References <kkv0sq$8mp$1@news.albasani.net> <kkv24n$b15$1@news.albasani.net> <3001426.0veXviQ4o9@PointedEars.de>

Show all headers | View raw


On 2013-04-21 00:22, Thomas 'PointedEars' Lahn wrote:
> Stefan Weiss wrote:
>> The easiest way is to use querySelector() or querySelectorAll():
>> 
>>   var ele = document.querySelector("[src='placeholder.gif']");
>>
[...]
> A correct answer that actually relates to the question is:  Once you have a 
> reference to the image object, say “img”, execute:
> 
>   img.id = "foo";
> 
> where "foo" is an example new ID.

Indeed. I actually forgot about the second part of the question, but you
got my back, Mr Spock. Thanks.

We make a great team, you and I.

Want to come over for coffee?

- stefan

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Based on its src value, find an image and assign an ID? Tuxedo <tuxedo@mailinator.com> - 2013-04-20 23:21 +0200
  Re: Based on its src value, find an image and assign an ID? Stefan Weiss <krewecherl@gmail.com> - 2013-04-20 23:42 +0200
    Re: Based on its src value, find an image and assign an ID? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-04-21 00:22 +0200
      Re: Based on its src value, find an image and assign an ID? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-04-21 00:36 +0200
      Re: Based on its src value, find an image and assign an ID? Stefan Weiss <krewecherl@gmail.com> - 2013-04-21 00:52 +0200
      Re: Based on its src value, find an image and assign an ID? Scott Sauyet <scott.sauyet@gmail.com> - 2013-04-20 17:20 -0700
        Re: Based on its src value, find an image and assign an ID? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-04-21 11:09 +0200
          Re: Based on its src value, find an image and assign an ID? Scott Sauyet <scott.sauyet@gmail.com> - 2013-04-23 06:32 -0700
  Re: Based on its src value, find an image and assign an ID? x@x.com (znôrt) - 2013-04-21 00:56 +0200
    Re: Based on its src value, find an image and assign an ID? x@x.com (znôrt) - 2013-04-21 00:59 +0200

csiph-web