I need to set the hidden input value when a button is clicked and it does not seem to be working.

```
<input type="hidden" name="addressOverride" id="addressOverride" value="">

```

Then the button

```
<button id="addressOverrideLink" class="global-button">Yes this is my correct delivery address</button>

```

And the code that is trying to set it

```
if ($('#addressOverrideLink'))
    {
        $('#addressOverrideLink').click(function(e){
            $('#addressOverride').val('YES');
            $('#mainForm').submit();
            return false;
        });
    }

```