javascript - Why is my innerHTML is overwriting style properties of the parent class? and how do i solve this? -


im aron , im newbie javascript

this problem:

i'm trying create new content form input in html if enter many characters in form, new html doesn't break down @ right width.

i hope explained correctly. here link site

here javascript:

function plaatsmagnet()     {          console.log('plaatsmagnet');          $('#magnetcontent').prepend('<div id="magnetjes" class="large-3 columns"></div>');          var textmagnet = $('#textmagnet').val()         var naammagnet = $('#inhoud').val()            var           divtag = document.createelement("div");          divtag.id = "magnetje";                divtag.classname =" panel";                divtag.innerhtml =   "<h5>" + (naammagnet) + "</h5>" + "<p>" + (textmagnet) + "</p>";          $('#magnetjes').append(divtag);       }; 

i hope guys can me! :)

 jescount = 0; // keep counter magnetjes divs  jecount = 0; // keep counter magnetje divs    // ids unique, magnetjes0,magnetjes1.... , magnetje0, magnetje1... // if can mantain array instead better. // have taken counters global vars show different id implementations each div. deally should encapsulate such change in function.  function plaatsmagnet() {      console.log('plaatsmagnet');      $('#magnetcontent').prepend('<div id="magnetjes'+ jescount +'" class="large-3 columns"></div>');      var textmagnet = $('#textmagnet').val()     var naammagnet = $('#inhoud').val()        var       divtag = document.createelement("div");      divtag.id = "magnetje" + jecount; // increment current value ,            jecount++;           divtag.classname =" panel";            divtag.innerhtml =   "<h5>" + (naammagnet) + "</h5>" + "<p>" + (textmagnet) + "</p>";      $('#magnetjes'+jescount).append(divtag);      jescount++;   }; 

Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -