0

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>

enter image description here

1

1 Answer 1

1

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> 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.