When using each method to traverse the array in JQ, the error $item is not defined is reported
Structure:
<div class="right">
<div class="img_bg rightOne" @click="clickLeft('Company Mission')">Company Mission</div>
<div class="img_bg rightTwo" @click="clickLeft('Core Values')">Core Values</div>
<div class="img_bg rightThree" @click="clickLeft('Corporate Spirit')">Corporate Spirit</div>
<div class="img_bg rightFour" @click="clickLeft('Brand Slogan')">Brand Slogan</div>
</div>
js:
$('.right div').each(function(index,item){
// var $this = $(item);
// $this.removeClass('is_active_right');
item.removeClass('is_active_right');
})
Solution:
$('.right div').each(function(index,item){
var $this = $(item);
$this.removeClass('is_active_right');
})
Read More:
- [Solved] Vue Error: error ‘xxx‘ is defined but never used no-unused-vars
- [Solved] Vue item error: Regeneratorruntime is not defined
- [Solved] Vuepress Package Error: document is not defined
- [Solved] Uncaught ReferenceError: axios is not defined
- [Solved] vite2+vue3 jsx Error: React is not defined
- ERROR Error: [@ant-design/icons-angular]:the icon XXX does not exist or is not registered.
- [Solved] vite package Error: globalThis is not defined
- Vuepress build error: window is not defined [How to Solve]
- vue eslint error ‘process‘ is not defined no-undef [How to Solve]
- How to Solve “Vue is not defined” Error
- [Solved] Vue 3 Script Setup ESLint Error: ‘defineProps‘ is not defined
- Ant design vue table Error: h is not defined [How to Solve]
- The reason why jQuery files report errors is introduced
- [Go] Can structure/structure pointer be compared with operator == is not defined error
- [Solved] Yapi Secondary deploy error: xxx validation failed: mock: Path `xxx` is required
- [Solved] Nuxt Import qrcodejs2.js / QRCode.js Error: document is not defined
- [Solved] Uncaught (in promise) TypeError: XXX.a is not a constructor
- ArcGIS API for JavaScript Error Uncaught(in promise): TypeError: xxx is not a constructor
- [Solved] Vue3 process Error: Uncaught ReferenceError: process is not defined
- [How to Solve] TypeError: XXX is read-only