i want to use jquery function (closest) in vue component and get ancestor with class mainBox but doesnt work and errors me that this.closest is not function
sorry im newbie in vue
this is my SubmitPhoneForm component:
<template>
<div>
<div class="formBox">
<form>
<input type="tel" placeholder="insert phone"/>
<input type="button" name="next" class="next action-button" value="Next" @click="changecolor()" />
</form>
</div>
</div>
</template>
<script>
export default {
methods: {
changecolor () {
this.closest('.mainBox').css({'background': 'black'})
}
}
}
</script>
and this is component that i use the component named SubmitPhoneForm in it :
<template>
<div>
<div class="mainBox">
<div class="screenBox">
<div class="contentBox">
<div class="title">title</div>
<div class="description">description</div>
<div class="moreDescription"></div>
<submit-phone-form></submit-phone-form>
</div>
<div class="carBox"></div>
</div>
</div>
</div>
</template>