---
title: "Jquery to check if an input has a specific name?"  
description: "Jquery to check if an input has a specific name?"  
author: "Anonymous User"  
published: 2013-10-05  
updated: 2013-10-05  
canonical: https://www.mindstick.com/forum/1629/jquery-to-check-if-an-input-has-a-specific-name  
category: "jquery"  
tags: ["jquery"]  
reading_time: 1 minute  

---

# Jquery to check if an input has a specific name?

Is there any [function to check](https://www.mindstick.com/forum/161900/write-a-function-to-check-if-a-number-is-prime-with-explanation) [if an input](https://www.mindstick.com/forum/156813/how-do-you-check-if-an-input-is-an-integer-c) has a specific name in jquery, like we check the existense of a [class](https://www.mindstick.com/blog/165/generic-class-in-c-sharp) using hasClass()?

For example if I have an input

<input type="[checkbox](https://www.mindstick.com/articles/291/how-should-use-checkbox-control-in-vb-dot-net)" class="col_control" checked="checked" name="sr_column" [data](https://www.mindstick.com/articles/13050/salesforce-aiming-to-dominate-predictive-analytics-with-data-science)-columnno="0" />

So that I can check hasName("sr_column") and it returns [true](https://yourviews.mindstick.com/view/81326/boycott-chinese-products-dream-will-come-true)

## Replies

### Reply by Anonymous User

You should use below line of code: -

```
var name = $("#id").attr("name");
```

OR

```
var name = $("#id").prop("name"); if(name=="sr_column"){   Write here code}
```


---

Original Source: https://www.mindstick.com/forum/1629/jquery-to-check-if-an-input-has-a-specific-name

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
