Reputation: 1447
How to affect a text click to a checkbox? Now it works as when we click on a checkbox it is selected, I want to select it while I'm clicking on the corresponding text also. Here my code,
<tr key={taskList.PriorityID}>
<td style={{'width':'100px'}}><input type='radio' id={taskList.ID} name={'ID: ' + taskList.ID} onClick={_onclick} checked={selected} /></td>
<td className="dashboard-post-payment_table-cell" title={'TaskList: ' + taskList.Priority}>{taskList.Priority}</td>
</tr>
Upvotes: 0
Views: 44
Reputation: 316
Try wrapping your text into label element like below.
<td style={{'width':'100px'}}>
<input type='radio' id={taskList.ID} name={'ID: ' + taskList.ID} onClick={_onclick} checked={selected} />
</td>
<td className="dashboard-post-payment_table-cell" title={'TaskList: ' + taskList.Priority}>
<label for={'ID: ' + taskList.ID}> {taskList.Priority}</label>
</td>
Upvotes: 1