jquery - Multiple div append and select with JavaScript -


i have created multiple div boxes (under planning) using javascript here

for (i = 0; < 168; i++) {     var idiv = document.createelement('div');     idiv.id = 'inc';     document.getelementbyid('appointmentchart').appendchild(idiv); } 

now need 2 more things done using javascript.

  1. on click inside div inside planning assign class="yellow" 3 consecutive div vertically (now divs arranged horizontally).

    do need arrange div vertically doing this? if so, how?

  2. go practicien @ left side, select chirurgie -> dupont marc , select date 10-mar-2014. see appointments visible @ multiple planning div chart. of them come out of container.

    how move overflowing section next div?

is possible achieve above-mentioned using javascript?

first of give different id's columns follows:

for (i = 0; < 168; i++) { var idiv = document.createelement('div'); idiv.id = 'inc'+i; //different id idiv.addeventlistener('click', clickfunction);// assign click handler document.getelementbyid('appointmentchart').appendchild(idiv); } 

assuming each row have 14 columns can do

function clickfunction(){  var num= parseint(this.id.substring(3));  for(var i=1;i<=3;i++){   document.getelementbyid('inc'+num).classname+= 'yellow'   num+=14;  } } 

update : fiddle


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -