Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: Retrieve a select from a table cell Date: Tue, 14 Jul 2015 22:07:08 +0200 Organization: PointedEars Software (PES) Lines: 23 Message-ID: <3951517.CJbgAzKFgc@PointedEars.de> References: Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: solani.org 1436904615 16595 eJwFwYEBgDAIA7CXptAi5wwK/59gAuPDDifoWOzYCSY2N2PubleUXOI7GDlwVDafjVPWvD8zSRIJ (14 Jul 2015 20:10:15 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Tue, 14 Jul 2015 20:10:15 +0000 (UTC) User-Agent: KNode/4.14.2 X-User-ID: eJwFwQkBwDAIA0BLlBA65PAU/xJ2R/jxvuZ043ILiZStemBCpKdHvulshARTn6/C2B0jHgk9FXpDnKYB/HL7FUc= Cancel-Lock: sha1:KS8XN2QEcthkP5nH0fvNxl8+mEA= X-NNTP-Posting-Host: eJwNwoERwCAIBLCVEPgHxqmg+49gL4FxscMJOu5PscqYBqmsbUHd0X1nRs2/PNM8CEMtFZd+/9QQTQ== Xref: csiph.com comp.lang.javascript:28421 Joao Rodrigues wrote: > function cellClick(e) { > var fc = e.target; > if (/input|select/i.test(fc.tagName)) { > window.alert(fc.type + " - " + fc.nodeName > + " - " + fc.value + " - " > + fc.nodeType); > } > } Not only as insufficient as your first approach (see my other follow-up), but even more inefficient and error-prone. If you are using a regular expression, you need to anchor it to prevent false positives, at least /^(input|select)$/i. But you can do without such an expensive RegExp here. Finally, the “input” appears to be coming from your imagination only; read again. -- PointedEars FAQ: | SVN: Twitter: @PointedEars2 | ES Matrix: Please do not cc me. / Bitte keine Kopien per E-Mail.