What is the process for adjusting settings through selected options in a pop-up menu?

Here are the choices available:

<form>
<select id="poSelect" >
<option selected disabled>Choose here</option>
<option id="buyeroption" value="100101">I am a Buyer</option>                                                                           
<option id="garageoption" value="100102">I am a Garage</option>                                                                           
</select>

<label>Full Name</label>
<input type="text" />

<label>Email Address</label>
<input type="email" />

<label>Password</label>
<input type="password" />

<label id="industrylabel" >Select Your Brand</label>
<select id="industryoption">
<option selected disabled>Select</option>   
<option value="Renault">Renault</option>
<option value="Pegaut">Pegaut</option>
<option value="Citroen">Citroen</option>
</select>

<div class="form-check-label">
<input id="send_updates" type="checkbox" />
<label for="send_updates">Send me occasional email updates</label>
 </div> 

My request is to hide the "Select Your Brand" label and industry option select when the user selects "I am a Buyer", but show it when they select "I am a Garage".

Answer №1

<form>
<select id="mySelection">
<option id="kiwi">Kiwi</option>
<option id="grape">Grape</option>
<option id="watermelon">Watermelon</option>
<option id="mango">Mango</option>
</select>
</form>
<p></p>

<button onclick="customFunction()">textbox1</button>
<p id="output"></p> 
<script>
function customFunction() {
var y = document.getElementById("mySelection").options.namedItem("mango").text;
document.getElementById("output").innerHTML = y;
 }
 </script>

Here's a similar example for reference, feel free to explore and modify: http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_select_options6

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Passing information between VueJs3 components

I have been coding a VueJs3 Project that includes a login system, and it's working perfectly. Now, I want to display the user's logged-in account on the homepage within a div. The message should be: "You are logged in as:" followed by the userna ...

Unknown custom element error in Laravel and Vuetify

I encountered errors in my Laravel project, specifically with custom elements like this. [Vue warn]: Unknown custom element: <v-app> - did you register the component correctly? For recursive components, make sure to provide the "name" option. found ...

What is the best method for restricting the visibility of an animation to specific regions within an SVG?

I am seeking assistance with adding a "shine" animation to my SVG. I want the animation to only appear within specific parts of the SVG, but I'm uncertain about how to achieve this. Below is what I have accomplished so far. The aim is for the white ...

Transform a bit of JavaScript to jQuery

I'm working with some JavaScript code that sets a link's URL using specified parameters. The code looks like this: link.NavigateUrl = string.Format("javascript:MyFunction({0}, {1});", ID1, ID2); This means that when the link is clicked, MyFunct ...

Adjust the border hue of the MUI disabled outline input

I am currently struggling to locate the exact definition of this border color. After inspecting the dom, I cannot seem to find any border style within the input component or its pseudo elements... My main goal is to slightly lighten the color of the input ...

Is it possible to maintain consistent numbering for ordered lists using only CSS, even when the lists are separate from each other?

Example: https://jsfiddle.net/jacobgoh101/uqrkaodc/3/ <ol> <li>a</li> </ol> <ul> <li>b</li> </ul> <ol> <li>c</li> <li>d</li> <li>e</li> </ol> ol li ...

The formatting of the list is not being correctly displayed in the Ajax Jquery list

Trying to dynamically generate an unordered list from XML onto a jQuery mobile page has been a bit of a challenge for me. While I can display the items on the page, the styling never seems to work properly, only showing up as plain text with blue links. Is ...

Using jQuery to smoothly scroll to a specific class name

I am faced with an HTML code snippet that looks like this: <div data-stored="storenow" data-save="save" class="saveIcon" data-unique="game">Save</div> My intention is to use jQuery to scroll to the game number 456 as shown below. var contain ...

Alternative names for Firefox's "error console" in different browsers

Are there similar tools to Firefox's "Error console" available in other web browsers? I rely on the error console for identifying JavaScript errors, but I haven't found a straightforward way to view error messages in other browsers like Internet ...

Create an array populated with unclosed HTML tags that need to be rendered

I'm trying to display a simple list, but it seems like React is having trouble rendering unclosed HTML elements that are pushed onto the list. This results in an error: ReferenceError: el is not defined If I use single quotes (') bookingStat ...

The HTML table fails to refresh after an Ajax request has been made

I am currently utilizing Ajax to delete a row from the Roles table. The functionality allows the user to add and delete roles using a link for each row. While the deletion process works properly and removes the row from the database, the table does not get ...

Pressing ctrl and clicking on a link created with the tag element in VueJS will activate

When using a router link without an anchor tag, I am able to ctrl+click the link to open it in a new tab. However, when used with a tag (e.g., tag="td"), the ctrl+click functionality no longer works. The same issue occurs with clickable elements generated ...

"Encountering errors during npm installation due to a failed preinstall

Having identified security vulnerabilities for knexnest > knex > minimist, I encountered an issue where the minimist version did not update using npm audit fix or a simple npm update. Following the steps outlined in this informative article resolved ...

How to use jQuery to update a text input field based on a selected <select> dropdown option

Hi there, I could really use some help with this issue... Here's the problem - I need to change the value of a textbox within a table based on the selection of an option in a dropdown. Here's a simplified version of what I mean: <select id= ...

Challenges with website design on Safari

When viewing the content under Chrome and IE, the two text blocks are displayed on the same line. However, in Safari 5.1.7, the text appears on different lines (above and below). Could there be something missing in the CSS that needs to be added for Safar ...

When using create-react-app with JEST to run tests, TypeScript errors are not displayed

When I write incorrect TypeScript code in my project set up with create-react-app, running tests using npm test does not show any errors in the terminal. Is this normal behavior? It would be helpful to see these errors to avoid writing incorrect TypeScript ...

Simple Selection Panel

Looking to include a simple dropdown menu with 5 choices. Once a selection is made, an answer corresponding to that choice will appear in another field next to it. For example: Choosing France from the dropdown would display 'Paris' in the adjac ...

Exploring the wonders of Ajax with KnockoutJS Mapping

I have been assigned the task of conducting a POC of KnockoutJS, but I am facing an issue that seems to be difficult to solve. My goal is to fetch data from a service using Ajax and then populate a form with ko.mapping.fromJS(). However, the form does not ...

Listening for Events on Multiple Groups of Radio Buttons

How can a dynamic Javascript/JQuery event listener determine which radio button group has been clicked and retrieve the value of the checked element? If there are two radio button groups, how would you differentiate between them? How could this be achieved ...

Ways to prioritize the parent element's style over the child element's style attribute

I am looking to customize the appearance of an unfamiliar HTML code by changing its text color to cyan, regardless of its current color. I attempted the following: <p style="color:cyan !important;"> <span style="color:red;">Hello World</ ...