JavaScript How can I create a javascript to show and hide info according option value selected? javascript create and show div,how to create a slideshow

FIDDLE

You need to give id to your div, then use:

divJan.style.display = "block";

block will show your div, none will hide it. You just need a function that will determine wich element is selected and an event to track the changes. Here's an example:

var cmbMonth = document.getElementById('month');
var divJan = document.getElementById('divJan');
var divFeb = document.getElementById('divFeb');
var divCoo = document.getElementById('divCoo');

cmbMonth.addEventListener('change', function (e) {

    if (cmbMonth.value == 1) {
        divJan.style.display = "block";
        divFeb.style.display = "none";
        divCoo.style.display = "none";

    } else if (cmbMonth.value == 2) {
        divJan.style.display = "none";
        divFeb.style.display = "block";
        divCoo.style.display = "none";

    } else if (cmbMonth.value == 3) {
        divJan.style.display = "none";
        divFeb.style.display = "none";
        divCoo.style.display = "block";
    }

});
Answer:1

A jQuery solution using

$('#month').change()

and

$(some id).hide()

JSFiddle

Answer:2

Everything works except for the replacement of the div. When i submit the form with jquery and ajax, my php stores the data in the database and it creates a new div that needs to be placed where the ...

Everything works except for the replacement of the div. When i submit the form with jquery and ajax, my php stores the data in the database and it creates a new div that needs to be placed where the ...

  1. with data in sql
  2. with data in r
  3. with data in excel
  4. with data of type
  5. curl with data from file
  6. with in data.table
  7. with in data.table r
  8. with in data bind
  9. curl post with data from file

I'm trying to display full month name like 'January 2014' with eyecon Bootstrap datepicker http://www.eyecon.ro/bootstrap-datepicker/ Does anybody know if it's possible? I've tried everything I know (...

I'm trying to display full month name like 'January 2014' with eyecon Bootstrap datepicker http://www.eyecon.ro/bootstrap-datepicker/ Does anybody know if it's possible? I've tried everything I know (...

  1. displayport
  2. display case
  3. display synonym
  4. display cabinet
  5. displayport cable
  6. display driver uninstaller
  7. displayport to hdmi
  8. display fusion
  9. display flex
  10. display shelves
  11. displayport vs hdmi
  12. display css
  13. display board
  14. displaylink
  15. display definition
  16. display shelf
  17. display stand
  18. display settings
  19. display cable
  20. display box

Hi I'm new to Backbone and I was just playing around with it a little, here is my code: var Users = Backbone.Collection.extend ({ url : 'http://backbonejs-beginner.herokuapp.com/users' ...

Hi I'm new to Backbone and I was just playing around with it a little, here is my code: var Users = Backbone.Collection.extend ({ url : 'http://backbonejs-beginner.herokuapp.com/users' ...

I am tyring to append different autocomplete list results in one text box. It is easy to give different text box for different autocomplete results. html : <input id="university" name="...

I am tyring to append different autocomplete list results in one text box. It is easy to give different text box for different autocomplete results. html : <input id="university" name="...