Question

How to do it only in html. "What people type appears under the field"

Hobby Surfing X Cars XDrawing X OceanX

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution:

You can do it using DOM objects in HTML bu slightly in a different way

Below is the given code

<!DOCTYPE html>
<html>
<body>

<form>
Select a fruit:
<br>
<select id="mySelect" size="4">
<option>Surfing</option>
<option>Cars</option>
<option>Drawing</option>
<option>Ocean</option>
</select>
</form>
<br>

<button onclick="myFunction()">Remove selected fruit</button>

<script>
function myFunction() {
var x = document.getElementById("mySelect");
x.remove(x.selectedIndex);
}
</script>

</body>
</html>

Output:

Select a fruit: Surfing Cars Drawing Ocean ▼ Remove selected fruit

I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)?

Add a comment
Know the answer?
Add Answer to:
How to do it only in html. "What people type appears under the field" Hobby Surfing...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT