javascript - Push text to array then append to div - displaying text in div twice in IE8 -


using mouseup, i'm appending multiple values array.

var myarray = []; $("#button").mouseup(function() {           myarray.push(" play contact sports");  ]); 

then appending div using button

$("#button2").mouseup(function() {          $('#output').append(myarray+'');  ]); 

it works fine in browsers apart ie8 text push after 1 click display twice.

play contact sports play contact sports 

there no comma. know cause might be? or alternative might work?

i'm not clear on want do, i'd wrap each text node you're appending element , more explicit array-to-string conversion. in click handler ensure event stopped:

$("#button2").mouseup( function(event) {    event.stoppropagation();    event.preventdefault();    $('<p></p>').html( myarray.join(',') ).appendto('#output');    return false; } ); 

Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -