---
title: "how to set id to Html.TextBox item on MVC"  
description: "how to set id to Html.TextBox item on MVC"  
author: "Anonymous User"  
published: 2013-09-28  
updated: 2013-09-28  
canonical: https://www.mindstick.com/forum/1551/how-to-set-id-to-html-textbox-item-on-mvc  
category: "asp.net mvc"  
tags: ["asp.net mvc"]  
reading_time: 1 minute  

---

# how to set id to Html.TextBox item on MVC

Im [trying](https://answers.mindstick.com/qa/93698/6-mistakes-couples-are-trying-to-save-money) to [catch](https://www.mindstick.com/forum/159341/how-to-use-try-and-catch-in-java-for-exception-handling-and-what-happens-when-an-exception-occurs) the [textbox](https://www.mindstick.com/forum/12714/dynamic-textbox-in-gridview) element by [javascript](https://www.mindstick.com/articles/874/how-to-create-watermark-text-for-textbox-by-using-javascript), in [order](https://www.mindstick.com/articles/12276/how-timely-order-deliveries-can-improve-customer-experience) to [put](https://answers.mindstick.com/qa/111890/can-you-explain-the-difference-between-put-and-post-http-methods) [text](https://www.mindstick.com/blog/301635/did-people-reinvent-texting-to-express-the-full-range-of-emotions) into it. so how to set id to the textbox ??

```
    <tr>
                    // Id to this textbox
            <td>@Html.TextBoxFor(item => item.OperationNo)</td>
        </tr>
```

and then to put text into it by JS

[document](https://www.mindstick.com/articles/328642/what-to-consider-while-choosing-a-software-documentation-tool).getElementById("Textbox id").Text= " Some text " ;

## Replies

### Reply by Anonymous User

Hey Ashish!

\

You can use below code for resolve that problem:

\

```
function steVal() {
        document.getElementById('txtPlace').value = "Set The Text";
    }
 @Html.TextBoxFor(m => m.OperationNo,new { @id = "txtPlace",@name="txtPlace" })
```


---

Original Source: https://www.mindstick.com/forum/1551/how-to-set-id-to-html-textbox-item-on-mvc

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
