'How Can I make an event after choosing an item on dropdown list with reactJs?
actually I'm working on reactJs project with Laravek API. I want to change the value of a field after choosing a item on a dropdown List. This an exemple : if I choose for example bimothly the value of Contract Rent Per Period Should be 444 (222*2) etc... [1]: https://i.stack.imgur.com/t58vK.png This is my code:
<Row>
<Col sm='6' className='mb-1'>
<Label className='form-label' >Select Period</Label>
<select className='form-control'>
<option>Select Period
</option>
{periodList.map((item) => {
return (<option value='periodicity'>{item.periodicity}</option>
)
})
}
</select>
</Col>
{unit.map((item) =>
<Col sm='6' className='mb-1'>
<Label className='form-label'>
Contract Rent Per Period
</Label>
<Input type='text' value={item?.unit_rent_per_month} />
</Col> )}
<Col sm='6' className='mb-1'>
<Label className='form-label' for='compl_date'>
Date <span className='text-danger'>*</span>
</Label>
<Flatpickr
className='form-control'
value={date}
id='date'
/>
</Col>
{unit.map((item) =>
<Col sm='6' className='mb-1'>
<Label className='form-label'>
Contract Rent Per Period
</Label>
<Input type='text' value={item?.unit_rent_per_month} />
</Col> )}
</Row>
I would be very thankful if anyone of you can help mee
Solution 1:[1]
you can add onClick on your Label and do with them what your want
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Yaroslav Pesotskii |
