Title: name attribute added through javascript not work
Last modified: July 7, 2021

---

# name attribute added through javascript not work

 *  [Hozefa Saleh](https://wordpress.org/support/users/hozefasmile/)
 * (@hozefasmile)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/name-attribute-added-through-javascript-not-work/)
 * Hi,
 * I am using a script for input tag field [https://www.cssscript.com/demo/multi-select-autocomplete-selectpure/](https://www.cssscript.com/demo/multi-select-autocomplete-selectpure/)
 * This script generate input field dynamically through its script and not add any
   name attribute by default in it.
 * So in my form I have added this one more line of javascript to have name attribute
   in its autogenerated input field.
 * `document.querySelector(".select-pure__autocomplete").setAttribute("name", "myinputtag");`
 * So that way now the field have name attribute in it. But when I add the shortcode[
   myinputtag] in the actions tab in email output message, its not sending selected
   tag in email (remain blank output for that field)
 * I am not sure where is the issue? I think this form need an input field as html
   with name attribute, otherwise it note take the output the field generated by
   JavaScript, is this true? or it is some issue at script that I am using ?

Viewing 1 replies (of 1 total)

 *  [Lap](https://wordpress.org/support/users/lapzor/)
 * (@lapzor)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/name-attribute-added-through-javascript-not-work/#post-14640512)
 * Would it be possible to create the fields in the form, maybe as hidden fields,
   instead of creating them dynamically?

Viewing 1 replies (of 1 total)

The topic ‘name attribute added through javascript not work’ is closed to new replies.

 * ![](https://ps.w.org/html-forms/assets/icon-256x256.png?rev=1754345)
 * [HTML Forms - Simple WordPress Forms Plugin](https://wordpress.org/plugins/html-forms/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/html-forms/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/html-forms/)
 * [Active Topics](https://wordpress.org/support/plugin/html-forms/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/html-forms/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/html-forms/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Lap](https://wordpress.org/support/users/lapzor/)
 * Last activity: [4 years, 10 months ago](https://wordpress.org/support/topic/name-attribute-added-through-javascript-not-work/#post-14640512)
 * Status: not resolved