I need to hide a field on a page using JavaScript. I’ve hidden the field successfully by doing this
$('[name="EndorsementTypeID"]').hide();
However, I am unable to hide the label. This is how the label and the field is defined so not sure what I am doing wrong.
<li>
<label for="EndorsementTypeID">Endorsement Type: </label>
<b>
<select id="EndorsementTypeID" name="EndorsementTypeID" aria-label="Endorsement Type">
<option value="-1">[No Endorsement Type]</option>
<option value="1">TEST</option>
</select></b>
</li>
2
Answers
This:
Selects this element:
Based on its
name
attribute. So to select this element:You could also use an attribute:
Visit https://area51.stackexchange.com/ regularly! Use angle brackets to force linking: Have you seen https://superuser.com?
To create fancier links, use Markdown:
Here’s a link! And a reference-style link to [a panda][1]. References don’t have to be [numbers][question]. [1]: https://notfound.stackexchange.com/ [question]: https://english.stackexchange.com/questions/11481
You can add tooltips to links:
Click [here](https://diy.stackexchange.com "this text appears when you mouse over")! This works with [reference links][blog