Question: I would like to create a new column in my dataframe which is equal to the last business day of the month based on the US calendar, ideally in the format mm/dd/yyyy. My goal is to create this variable per day and set it for every day in the month corresponding to my existing `'DATES'` column. For example, for every day in January I want to create a a variable equal to `'01/31/2020'`, in a string format. For everyday in February I want to set a variable equal to `'02/28/2020'`, in string format.

If anyone has ideas would be of great help!

[Dataframe example](https://i.stack.imgur.com/n8eu1.png)

Answer: 
You can use [aria-labelledby](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-labelledby_attribute) attribute for this instead. The `aria-labelledby` attribute establishes relationships between objects and their label(s), and its value should be one or more element IDs.

Here, we can assume `test2` is actually what you have in the code like `this.element.id`. Using that we can get the `aria-labelledby` attribute value using [`getAttribute()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute) method. Then we can simply pass that to `document.querySelector` to get the closest label w.r.t the input id.

```js
let input = document.querySelector(`#test2`)
let labelId = input.getAttribute('aria-labelledby')

let el1 = document.querySelector(`label[id="${labelId}"]`)
el1.style.color = "green"
```

```html
<div>
  <label id="interval">Interval</label><br>
  <input min="0.1" id="test" placeholder="Min" step="0.1" type="number" aria-labelledby="interval">
  <input min="0.1" id="test2" placeholder="Max" step="0.1" type="number" aria-labelledby="interval">
</div>
```
I made a function `searchLabel` for you!

```js
function searchLabel(inputElem) {
  var elem = inputElem;
  while (true) {
    if (elem.tagName == "LABEL") {
      break;
    }
    if (elem == null) {
      break;
    }
    elem = elem.previousSibling;
  }
  return elem;
}
console.log(searchLabel(document.getElementById("test2")));
```

```html
<div id="myDiv">
  <label for="test">Interval</label><br>
  <input min="0.1" id="test" placeholder="Min" step="0.1" type="number">
  <input min="0.1" id="test2" placeholder="Max" step="0.1" type="number">

  <label for="limit">Limit</label><br>
  <input id="limit" step="1" type="number">
</div>
```