javascript - IE not updating code after jQuery? -


i have calendar asp page users schedule times , everyone's times displayed on table (similar google calendar month view). have , running , works great need edit page on printing ensure fits on 1 page. table generated through asp loop here basic structure

<table id='calendar' class="cal"> <tr class="cal">     <td class="cal" onclick="shoform('5_10');">10     <div class="celldiv" id="5_10"></div>     </td> </tr> </table> 

i populate table using jquery , ajax example item under 1 of cells so:

<div id='1' class='item'> <span name='itmusername' id='user1'>user1</span> <span class='dnprint'><br/></span> project: <span name='tasks' id='2'>reviewing</span>1.5 hrs </div> 

in jquery, append items cells (where curitemday date item):

$("#"+curitemday).append(     "<div id='"...see above.../div>" ); 

now works fine , dandy , visually web page loads perfect. however, trying hide pieces when click on "print" button.

function printthis(){     var names=document.getelementsbyname("itmusername");     for(var i=0;i<names.length;i++){         if(names[i].innerhtml.split(" ").length>1)             names[i].innerhtml=names[i].innerhtml.charat(0)+names[i].innerhtml.split(" ")[1].charat(0);         names[i].innerhtml="["+names[i].innerhtml+"] ";     } ...more code.... } 

this works fine in ff in ie not work. when through code in ie using developer console (f12) doesn't show items added via jquery. page loads , displays everything, code doesn't seem reflecting on page.

<td class="cal" onclick="shoform('5_16');">     text - 16     <div class="celldiv" id="5_16"/> </td> 

note: ie version 8.0.6001.18702

you excessively abusing innerhtml property.

instead, why not this:

<span name="itmusername"><span class="printon">[</span>j<span class="printoff">ohn </span>s<span class="printoff">mith</span><span class="printon">]</span></span> 

then use css:

@media screen {.printon {display:none}} @media print {.printoff {display:none}} 

this show/hide relevant parts when user printing or viewing on-screen.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -