---
title: "How to change value of input with jquery under this class?"  
description: "How to change value of input with jquery under this class?"  
author: "Anonymous User"  
published: 2015-01-30  
updated: 2015-01-30  
canonical: https://www.mindstick.com/forum/12923/how-to-change-value-of-input-with-jquery-under-this-class  
category: "asp.net"  
tags: ["jquery", "javascript", "html"]  
reading_time: 1 minute  

---

# How to change value of input with jquery under this class?

**jQuery:**

```
$('.clickhere').click(function(e){    e.preventDefault();    $(this).closest('.row').children('.abc').hide();
// working    $(this).closest('.row').children('.abc').children('input').value
= ''; // not working    $(this).closest('.bookingrow').children('.addressbox').children('input').value('');
// alternative - not working});
```

**[html](https://www.mindstick.com/articles/1530/design-a-simple-stylish-calculator-using-html-css-and-javascript)**

```
<div class="row">  <div class='abc'>     <input type='text'class='unknown' />  </div>  <div class="clickhere">hide</div></div>
```

my [target](https://yourviews.mindstick.com/view/81207/small-industries-should-be-the-target-of-economic-relief-package) is if i [click](https://www.mindstick.com/articles/12423/social-login-magento-2-one-click-to-register-social) the "clickhere" [class](https://www.mindstick.com/blog/165/generic-class-in-c-sharp), [content](https://www.mindstick.com/articles/13019/get-the-best-content-marketing-pricing-packages-for-your-brand) under "abc" class will hide and whatever content added by [customer](https://www.mindstick.com/articles/325839/how-to-improve-your-business-level-of-customer-service) on those [input](https://www.mindstick.com/forum/159209/how-can-i-read-convert-an-input-stream-into-a-string-in-java) box, they will be clear.

same html used [multiple](https://www.mindstick.com/blog/12797/iowa-is-expected-to-see-heavy-growth-in-multiple-sectors) time on the same form. that's why using "$(this)".\
any solution? what i am [doing wrong](https://answers.mindstick.com/qa/36736/what-are-indians-doing-wrong-on-whatsapp)?\
Thanks in advance.

## Replies

### Reply by Anonymous User

**You need to use** .val() to set the value, jQuery methods normally will return a jQuery object not a dom element reference so you would not have a properly called .value.

$(this).closest('.row').find('.abc input').val('');

So

```
$('.clickhere').click(function (e) {    e.preventDefault();    //cache the value of .row since it is used multiple times    var $row = $(this).closest('.row');    $row.children('.abc').hide();
// working    $row.find('.abc
input').val('');});
```


---

Original Source: https://www.mindstick.com/forum/12923/how-to-change-value-of-input-with-jquery-under-this-class

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
