locked
document.createElement is not working in Firefox but it is working fine in IE RRS feed

  • Question

  • User-1602406894 posted

    Hi..

     

    document.createElement is not working in Firefox but it is working fine in IE.

     

    var div1 = document.createElement('div');
    var div2 = document.createElement('div');
    var cover = bookSearch.results[i].thumbnailHtml;

    cover.src = bookSearch.results[i].thumbnailHtml;
    var a = document.createElement('a');
    var br = document.createElement('<br/>');
    var br1 = document.createElement('<br/>');
    var br2 = document.createElement('<br/>');
    var auth = document.createElement('div');
    a.href = bookSearch.results[i].Url;
    a.innerHTML = bookSearch.results[i].title;
    auth.innerHTML = bookSearch.results[i].authors;
    div1.appendChild(cover);
    div2.appendChild(a);
    div2.appendChild(br1);
    div2.appendChild(auth);
    div2.appendChild(br2);

    var tab = document.createElement('table');
    var tbo = document.createElement('tbody');
    var row = document.createElement("tr");
    var cell1 = document.createElement("td");
    var cell2 = document.createElement("td");
    cell1.appendChild(div1);
    cell2.appendChild(div2);
    row.appendChild(cell1);
    row.appendChild(cell2);
    tbo.appendChild(row);
    tab.appendChild(tbo);
    document.body.appendChild(tab);

     

    Monday, January 10, 2011 3:54 AM

Answers

  • User418155246 posted

    var br = document.createElement('<br/>');
    var br1 = document.createElement('<br/>');
    var br2 = document.createElement('<br/>');

    var br = document.createElement('br');
    var br1 = document.createElement('br');
    var br2 = document.createElement('br');

    Does this fix it?


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, January 10, 2011 9:02 AM