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.
on click inside
divinside planning assignclass="yellow"3 consecutivedivvertically (nowdivs arranged horizontally).do need arrange div vertically doing this? if so, how?
go
practicien@ left side, selectchirurgie->dupont marc, select date10-mar-2014. see appointments visible @ multiple planningdivchart. 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
Post a Comment