#JSX in select option
2 messages · Page 1 of 1 (latest)
The JSX needs to be in the value of an attribute:
<select>
<option selected={s == 'test1'} value="test1">Test1</option>
</select>
2 messages · Page 1 of 1 (latest)
Can't seem to add in VSCode, which show in red wangle when I add JSX for default selected option. Might be Astro or TypeScript extension issue?
<select>
<option {s == 'test1' && 'selected'} value="test1">Test1</option>
</select>
VSCode error
Declaration or statement expected.
The JSX needs to be in the value of an attribute:
<select>
<option selected={s == 'test1'} value="test1">Test1</option>
</select>