Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #35098
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Serialise form with input of type image |
| Date | 2018-05-22 15:55 +0200 |
| Organization | PointedEars Software (PES) |
| Message-ID | <4736345.frT0xW2Khb@PointedEars.de> (permalink) |
| References | <LfqdneZ61dqoiGDHnZ2dnUU7-IvNnZ2d@westnet.com.au> <pdjopf$3t3$1@solani.org> |
Christoph M. Becker wrote:
> If you really need <input type="image"> elements, you could replace
> `frm.elements` with `frm.getElementsByTagName("input")`, or such.
As for “such”:
function serialiseForm (frm)
{
let a = [];
return a.slice.call(frm.elements)
.concat(
a.filter.call(
frm.getElementsByTagName("input"),
(control) => control.type.toLowerCase() === "image"))
.map((el) => {
return {
"type": el.type,
// ...
};
});
}
Use backwards-compatible syntax as necessary.
BTW, “`” is the /TemplateLiteral/ delimiter now (ES 6+).
--
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Serialise form with input of type image Andrew Poulos <ap_prog@hotmail.com> - 2018-05-17 15:37 +1000
Re: Serialise form with input of type image Andrew Poulos <ap_prog@hotmail.com> - 2018-05-17 18:56 +1000
Re: Serialise form with input of type image "Christoph M. Becker" <cmbecker69@arcor.de> - 2018-05-17 13:24 +0200
Re: Serialise form with input of type image Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-05-22 15:55 +0200
Re: Serialise form with input of type image Andrew Poulos <ap_prog@hotmail.com> - 2018-05-23 10:17 +1000
Re: Serialise form with input of type image JR <jr@yahoo.com> - 2018-05-23 16:42 -0300
Re: Serialise form with input of type image Andrew Poulos <ap_prog@hotmail.com> - 2018-05-24 11:21 +1000
Re: Serialise form with input of type image Joao Rodrigues <jr@yahoo.com> - 2018-05-24 00:41 -0300
Re: Serialise form with input of type image Andrew Poulos <ap_prog@hotmail.com> - 2018-05-24 18:17 +1000
csiph-web