---
title: "How to get element name of value?"  
description: "How to get element name of value?"  
author: "Anonymous User"  
published: 2014-10-04  
updated: 2014-10-04  
canonical: https://www.mindstick.com/forum/2301/how-to-get-element-name-of-value  
category: "jquery"  
tags: ["jquery", "javascript"]  
reading_time: 1 minute  

---

# How to get element name of value?

need to get all text of [value](https://www.mindstick.com/articles/23219/an-optimized-description-adds-value-to-experience-and-in-turn-effectively-guest-posting-packages), then use [json](https://www.mindstick.com/forum/34446/convert-json-string-to-object) to send the value to [insert](https://www.mindstick.com/blog/173/executing-insert-delete-or-update-query-in-sqlserver-using-ado-dot-net) all of price to the [database](https://www.mindstick.com/articles/12226/use-of-database-in-sencha-extjs-and-insert-record-from-user-form-using-ajax), but i had the [problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic), i can't get the text of all value where [input](https://www.mindstick.com/forum/159209/how-can-i-read-convert-an-input-stream-into-a-string-in-java) text [name](https://yourviews.mindstick.com/view/87450/how-to-generate-a-brand-name-using-linkedin-comprehensive-guide)='price'. here this is [HTML](https://www.mindstick.com/articles/1530/design-a-simple-stylish-calculator-using-html-css-and-javascript) code:\
here is Html code:\

```
<input type='text' id='price1' name='price[]'/> <input type='text' id='price2' name='price[]'/> <button type='button' id='btn'/>
```

**[JQuery code](https://www.mindstick.com/forum/157821/write-a-jquery-code-that-selects-all-the-checkboxes-in-a-form-when-a-select-all-button-is-clicked):**

```
<script>    $('#btn').click(function (e) {        var myprice = [];        myprice = $("*[name='price']").val();        $.post(            "index.php",            {                type: "insert",                price: myprice,            }        ).done(function (data) {            console.log(data);        })    });</script>
```

## Replies

### Reply by Anonymous User

you can use .map() to get all values

```
<script>    var myprice = $.map($('[name="price[]"]'), function (v, i) {        return v.value;    }).join(',');</script>
```


---

Original Source: https://www.mindstick.com/forum/2301/how-to-get-element-name-of-value

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
