Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #30876
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
| Newsgroups | comp.lang.javascript |
| Subject | Re: getElementsByClassName only inserts first image into canvas after ruby each loop |
| Date | Sat, 16 Jul 2016 13:19:44 +0100 |
| Organization | A noiseless patient Spider |
| Lines | 50 |
| Message-ID | <8760s5n5b3.fsf@bsb.me.uk> (permalink) |
| References | <3397987e-7925-4c49-8a94-d5f12a152223@googlegroups.com> <87lh192ff0.fsf@bsb.me.uk> <267f7082-d654-4a09-81d6-78f90e2a1fe6@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain |
| Injection-Info | mx02.eternal-september.org; posting-host="017616aa25f81ec581c44d76d61ba2f3"; logging-data="7796"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/hsOYrlRmGKq/Jz36tzjs5itbbKPAUyis=" |
| Cancel-Lock | sha1:PZEopecXDI00pRkRhWvZMHCViEo= sha1:B8922XyvhWuH3aG7x/W4I/f2bc4= |
| X-BSB-Auth | 1.1b7774d1d62878cce713.20160716131944BST.8760s5n5b3.fsf@bsb.me.uk |
| Xref | csiph.com comp.lang.javascript:30876 |
Show key headers only | View raw
patrick lowry <plowry05@gmail.com> writes:
> On Sunday, July 10, 2016 at 8:21:13 PM UTC-4, Ben Bacarisse wrote:
<snip>
>> ... The
>> normal way to operate on the clicked element is to access it though the
>> event object that is usually passed to the event handler.
<snip>
> Would you mind providing an example of how to do this or an better
> explanation on how you would accomplish this? I have tried may
> different ways using this approach but nothing seems to work.
You are using JQuery, I think, and I don't know JQUery. Here is a very
bare example In plain ECMAScript:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
window.addEventListener(
'load',
function () {
var odiv = document.getElementById('out');
var as = document.getElementsByTagName('a');
for (var i = 0; i < as.length; i++) {
as[i].addEventListener(
'click',
function (evt) {
odiv.innerHTML = evt.target.innerHTML;
},
false);
}
}
},
false);
</script>
<title>Click test</title>
</head>
<body>
<div>
<a>ONE</a>
<a>TWO</a>
</div>
<div id=out></div>
</body>
</html>
--
Ben.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
getElementsByClassName only inserts first image into canvas after ruby each loop plowry05@gmail.com - 2016-07-09 21:07 -0700
Re: getElementsByClassName only inserts first image into canvas after ruby each loop JJ <jj4public@vfemail.net> - 2016-07-10 20:16 +0700
Re: getElementsByClassName only inserts first image into canvas after ruby each loop howtovideos3421@gmail.com - 2016-07-10 08:40 -0700
Re: getElementsByClassName only inserts first image into canvas after ruby each loop patrick lowry <plowry05@gmail.com> - 2016-07-10 08:44 -0700
Re: getElementsByClassName only inserts first image into canvas after ruby each loop Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-11 01:21 +0100
Re: getElementsByClassName only inserts first image into canvas after ruby each loop patrick lowry <plowry05@gmail.com> - 2016-07-15 20:59 -0700
Re: getElementsByClassName only inserts first image into canvas after ruby each loop "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-07-16 09:21 +0200
Re: getElementsByClassName only inserts first image into canvas after ruby each loop Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-16 13:19 +0100
Re: getElementsByClassName only inserts first image into canvas after ruby each loop Osmo Saarikumpu <osmo@weppipakki.com> - 2016-07-17 07:32 +0300
Re: getElementsByClassName only inserts first image into canvas after ruby each loop Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-17 13:42 +0100
Re: getElementsByClassName only inserts first image into canvas after ruby each loop "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-07-17 15:06 +0200
Re: getElementsByClassName only inserts first image into canvas after ruby each loop Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-17 14:20 +0100
Re: getElementsByClassName only inserts first image into canvas after ruby each loop "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-07-17 16:02 +0200
Re: getElementsByClassName only inserts first image into canvas after ruby each loop patrick lowry <plowry05@gmail.com> - 2016-07-17 05:56 -0700
Re: getElementsByClassName only inserts first image into canvas after ruby each loop patrick lowry <plowry05@gmail.com> - 2016-07-17 05:51 -0700
Re: getElementsByClassName only inserts first image into canvas after ruby each loop Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-17 14:23 +0100
Re: getElementsByClassName only inserts first image into canvas after ruby each loop Martin Honnen <martin.honnen@gmx.de> - 2016-07-17 15:34 +0200
Re: getElementsByClassName only inserts first image into canvas after ruby each loop patrick lowry <plowry05@gmail.com> - 2016-07-17 18:03 -0700
csiph-web