Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic Data #9

Open
Chandan746 opened this issue Jun 29, 2019 · 0 comments
Open

Dynamic Data #9

Chandan746 opened this issue Jun 29, 2019 · 0 comments

Comments

@Chandan746
Copy link

Chandan746 commented Jun 29, 2019

How i can put this on dynamic data that are created by function

`

   {% load emoticons_tags %}
  <div class="messages">
      {% emoticons %}
    <ul id="chat-log"  >
      
        Documenting is boring but usefull :p
      
      <li class="replies">
        <img src='{{rec_img}}' alt="" />
        <p>When you're backed against the wall, break the god damn thing down.</p>
      </li> <li class="sent">
        <img src='{{rec_img}}' alt="" />
        <p>How the hell am I supposed to get a jury to believe you when I am not even sure that I do?! :p </p>
      </li>
       
    </ul >
    {% endemoticons %}`

`

function createMessage(data) {
  var author = data['author'];
  
  var msgListTag = document.createElement('li');
  var imgTag = document.createElement('img');
  var pTag = document.createElement('p');
  pTag.textContent =  data.content;
  imgTag.src = usrurl;

  
  if (author === username) {
    msgListTag.className = 'sent';
    imgTag.src = usrurl;
  } else {
    msgListTag.className = 'replies';
    imgTag.src =recurl;
  }

  msgListTag.appendChild(imgTag);
  msgListTag.appendChild(pTag);
  document.querySelector('#chat-log').appendChild(msgListTag);
  }`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant