Access our premium support and let us know your problems, we will help you solve them.

0
No products in the cart.

Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • blankkamil-kielczewski
    Participant

    Try

    dropdown.selectedOptions[0].text
    
    function read() {
      console.log( dropdown.selectedOptions[0].text );
    }
    <select id="dropdown">
      <option value="1">First</option>
      <option value="2">Second</option>
    </select>
    <button onclick="read()">read</button>
    in reply to: Scroll to an element with jQuery #9755
    blankkamil-kielczewski
    Participant

    ONELINER

    subject.onclick = e=> window.scroll({top: submit.offsetTop, behavior:'smooth'});
    
    subject.onclick = e=> window.scroll({top: submit.offsetTop, behavior: 'smooth'});
    .box,.foot{display: flex;background:#fdf;padding:500px 0} .foot{padding:250px}
    <input type="text" class="textfield" value="click here" id="subject" name="subject">
    
    <div class="box">
      Some content
      <textarea></textarea>
    </div>
    
    <input type="submit" class="submit" id="submit" name="submit" value="Ok, Done.">
    
    <div class="foot">Some footer</div>
    in reply to: How can I change an element's class with JavaScript? #9692
    blankkamil-kielczewski
    Participant

    Try:

    element.className='second'
    
    function change(box) { box.className='second' }
    .first  { width:  70px; height:  70px; background: #ff0                 }
    .second { width: 150px; height: 150px; background: #f00; transition: 1s }
    <div onclick="change(this)" class="first">Click me</div>
Viewing 3 posts - 1 through 3 (of 3 total)