How Can I print users selected? [closed]











up vote
-2
down vote

favorite












I have a little problem with JavaScript! I want to print users selected thing in Javascript!



For Example:



We have a list




  • Apple

  • Coffe

  • Banana


  • If users select banana I wanna return it like this "You selected banana"(Sorry my bad English)










    share|improve this question















    closed as unclear what you're asking by Utkanos, charlietfl, Lux, Dan O, Gary Nov 11 at 4:52


    Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.











    • 1




      Welcome to SO. It's a place where we help you with your code; we don't write code for you. Please see How to ask a good question. Show us what you've tried, then we can help, and be sure to post all relevant code in the question.
      – Utkanos
      Nov 10 at 19:28












    • Please, share what you already have done. Thank you.
      – Tornike Shavishvili
      Nov 10 at 19:49















    up vote
    -2
    down vote

    favorite












    I have a little problem with JavaScript! I want to print users selected thing in Javascript!



    For Example:



    We have a list




  • Apple

  • Coffe

  • Banana


  • If users select banana I wanna return it like this "You selected banana"(Sorry my bad English)










    share|improve this question















    closed as unclear what you're asking by Utkanos, charlietfl, Lux, Dan O, Gary Nov 11 at 4:52


    Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.











    • 1




      Welcome to SO. It's a place where we help you with your code; we don't write code for you. Please see How to ask a good question. Show us what you've tried, then we can help, and be sure to post all relevant code in the question.
      – Utkanos
      Nov 10 at 19:28












    • Please, share what you already have done. Thank you.
      – Tornike Shavishvili
      Nov 10 at 19:49













    up vote
    -2
    down vote

    favorite









    up vote
    -2
    down vote

    favorite











    I have a little problem with JavaScript! I want to print users selected thing in Javascript!



    For Example:



    We have a list




  • Apple

  • Coffe

  • Banana


  • If users select banana I wanna return it like this "You selected banana"(Sorry my bad English)










    share|improve this question















    I have a little problem with JavaScript! I want to print users selected thing in Javascript!



    For Example:



    We have a list




  • Apple

  • Coffe

  • Banana


  • If users select banana I wanna return it like this "You selected banana"(Sorry my bad English)







    javascript






    share|improve this question















    share|improve this question













    share|improve this question




    share|improve this question








    edited Nov 10 at 19:29

























    asked Nov 10 at 19:26









    Maksat Orazsahedow

    82




    82




    closed as unclear what you're asking by Utkanos, charlietfl, Lux, Dan O, Gary Nov 11 at 4:52


    Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.






    closed as unclear what you're asking by Utkanos, charlietfl, Lux, Dan O, Gary Nov 11 at 4:52


    Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.










    • 1




      Welcome to SO. It's a place where we help you with your code; we don't write code for you. Please see How to ask a good question. Show us what you've tried, then we can help, and be sure to post all relevant code in the question.
      – Utkanos
      Nov 10 at 19:28












    • Please, share what you already have done. Thank you.
      – Tornike Shavishvili
      Nov 10 at 19:49














    • 1




      Welcome to SO. It's a place where we help you with your code; we don't write code for you. Please see How to ask a good question. Show us what you've tried, then we can help, and be sure to post all relevant code in the question.
      – Utkanos
      Nov 10 at 19:28












    • Please, share what you already have done. Thank you.
      – Tornike Shavishvili
      Nov 10 at 19:49








    1




    1




    Welcome to SO. It's a place where we help you with your code; we don't write code for you. Please see How to ask a good question. Show us what you've tried, then we can help, and be sure to post all relevant code in the question.
    – Utkanos
    Nov 10 at 19:28






    Welcome to SO. It's a place where we help you with your code; we don't write code for you. Please see How to ask a good question. Show us what you've tried, then we can help, and be sure to post all relevant code in the question.
    – Utkanos
    Nov 10 at 19:28














    Please, share what you already have done. Thank you.
    – Tornike Shavishvili
    Nov 10 at 19:49




    Please, share what you already have done. Thank you.
    – Tornike Shavishvili
    Nov 10 at 19:49












    1 Answer
    1






    active

    oldest

    votes

















    up vote
    0
    down vote



    accepted










    You can use a select and add a change event listener.






    var select = document.querySelector('select'),
    res = document.querySelector('p');
    select.addEventListener('change', function(e){
    res.textContent = 'You selected '+this.value;
    });

    <select>
    <option value="Apple">Apple</option>
    <option value="Coffe">Coffe</option>
    <option value="Banana">Banana</option>
    </select>
    <p></p>








    share|improve this answer




























      1 Answer
      1






      active

      oldest

      votes








      1 Answer
      1






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      0
      down vote



      accepted










      You can use a select and add a change event listener.






      var select = document.querySelector('select'),
      res = document.querySelector('p');
      select.addEventListener('change', function(e){
      res.textContent = 'You selected '+this.value;
      });

      <select>
      <option value="Apple">Apple</option>
      <option value="Coffe">Coffe</option>
      <option value="Banana">Banana</option>
      </select>
      <p></p>








      share|improve this answer

























        up vote
        0
        down vote



        accepted










        You can use a select and add a change event listener.






        var select = document.querySelector('select'),
        res = document.querySelector('p');
        select.addEventListener('change', function(e){
        res.textContent = 'You selected '+this.value;
        });

        <select>
        <option value="Apple">Apple</option>
        <option value="Coffe">Coffe</option>
        <option value="Banana">Banana</option>
        </select>
        <p></p>








        share|improve this answer























          up vote
          0
          down vote



          accepted







          up vote
          0
          down vote



          accepted






          You can use a select and add a change event listener.






          var select = document.querySelector('select'),
          res = document.querySelector('p');
          select.addEventListener('change', function(e){
          res.textContent = 'You selected '+this.value;
          });

          <select>
          <option value="Apple">Apple</option>
          <option value="Coffe">Coffe</option>
          <option value="Banana">Banana</option>
          </select>
          <p></p>








          share|improve this answer












          You can use a select and add a change event listener.






          var select = document.querySelector('select'),
          res = document.querySelector('p');
          select.addEventListener('change', function(e){
          res.textContent = 'You selected '+this.value;
          });

          <select>
          <option value="Apple">Apple</option>
          <option value="Coffe">Coffe</option>
          <option value="Banana">Banana</option>
          </select>
          <p></p>








          var select = document.querySelector('select'),
          res = document.querySelector('p');
          select.addEventListener('change', function(e){
          res.textContent = 'You selected '+this.value;
          });

          <select>
          <option value="Apple">Apple</option>
          <option value="Coffe">Coffe</option>
          <option value="Banana">Banana</option>
          </select>
          <p></p>





          var select = document.querySelector('select'),
          res = document.querySelector('p');
          select.addEventListener('change', function(e){
          res.textContent = 'You selected '+this.value;
          });

          <select>
          <option value="Apple">Apple</option>
          <option value="Coffe">Coffe</option>
          <option value="Banana">Banana</option>
          </select>
          <p></p>






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 11 at 3:40









          hev1

          5,4233527




          5,4233527















              Popular posts from this blog

              Florida Star v. B. J. F.

              Error while running script in elastic search , gateway timeout

              Adding quotations to stringified JSON object values