Skip to content

Commit 30abc00

Browse files
committed
refactor: move click events to the a element, remove console.log test
1 parent f1ab07a commit 30abc00

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/components/ApiExplorer.astro

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,12 +263,11 @@ import { Aside, Icon } from '@astrojs/starlight/components'
263263
pokeapiPathInput.scrollIntoView({ behavior: 'smooth', block: 'start' })
264264
}
265265

266-
const inputHints = document.querySelectorAll('.input-hints code')
267-
inputHints.forEach((inputHint) => {
268-
console.log(inputHint.innerText)
266+
const inputHints = document.querySelectorAll('.input-hints')
269267

270-
inputHint.addEventListener('click', function () {
271-
pokeapiPathInput.value = inputHint.innerText
268+
inputHints.forEach((inputHintLink) => {
269+
inputHintLink.addEventListener('click', function () {
270+
pokeapiPathInput.value = inputHintLink.querySelector('code').innerText
272271
sendRequest()
273272
})
274273
})

0 commit comments

Comments
 (0)