JavaScript How to change value of div when clicking on some list item? change value in dictionary python,change value in dataframe,change

I have built a dropdown list, but I am not entirely happy with it. I am struggling with how to change the value of the default state, with the value of the clicked list item.

The HTML:

<div class="dropdown">
  <input class="dropdown-toggle" type="text">
  <div class="dropdown-text">Account</div>
  <ul class="dropdown-content">
    <li><a target='_blank' href="#">Settings</a></li>
    <li><a target='_blank' href="#">Projects</a></li>
    <li><a target='_blank' href="#">Log out</a></li>
  </ul>
</div>

And JS I am using:

var ddl = document.getElementByClass('dropdown-content');
var opts = ddl.options.length;
for (var i=0; i<opts; i++){
    if (ddl.options[i].value == "some-value"){
        ddl.options[i].selected = true;
        break;
    }
}

This doesn't work and I can't get why. Am a newbie in JavaScript. I want to change "Account" with whatever you click on, in the dropdown list.

Here is a Fiddle:

https://jsfiddle.net/xrqas38n/

PS: I don't want to use jQuery.

Answer:1

Meteor accounts uses the following function to validate password format: validatePassword = function (password) { if (password.length >= 6) { return true; } else { loginButtonsSession....

Meteor accounts uses the following function to validate password format: validatePassword = function (password) { if (password.length >= 6) { return true; } else { loginButtonsSession....

  1. custom password validation in angular 7
  2. custom password validation in angular 4
  3. custom password validation in jquery
  4. custom password validation in angular
  5. custom password validation in angular 6
  6. custom password validation in angularjs
  7. custom password validation in angular 5
  8. custom password validation in angular 8
  9. password custom validation in asp.net

A function whose declared type is neither 'void' nor 'any' must return a value. I have a createOrder function, that is supposed to return a promise. I have database calls in the function, and I'd ...

A function whose declared type is neither 'void' nor 'any' must return a value. I have a createOrder function, that is supposed to return a promise. I have database calls in the function, and I'd ...

I'm trying to split text the following like on spaces: var line = "Text (what is)|what's a story|fable called|named|about {Search}|{Title}" but I want it to ignore the spaces within parentheses. ...

I'm trying to split text the following like on spaces: var line = "Text (what is)|what's a story|fable called|named|about {Search}|{Title}" but I want it to ignore the spaces within parentheses. ...

  1. split string spaces java
  2. split string spaces python
  3. split string spaces c++
  4. split string spaces javascript
  5. split string spaces php
  6. split string spaces regex
  7. split string without spaces python
  8. split string without spaces into words java
  9. split string without spaces java
  10. split string multiple spaces python
  11. split string without spaces javascript
  12. split string by spaces python 3
  13. split string by spaces golang
  14. java split string spaces into array
  15. powershell split string spaces
  16. split string multiple spaces java
  17. split string by spaces matlab
  18. split string by spaces sql

I have a template Hello, ${user.name} stored in a variable. I am reading this from an external file using fs.read. Now, obviously when I attach to the innerHTML of a target div, it shows the string ...

I have a template Hello, ${user.name} stored in a variable. I am reading this from an external file using fs.read. Now, obviously when I attach to the innerHTML of a target div, it shows the string ...