Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

Quick Cross Browser JS question

  • 10-10-2011 12:48PM
    #1
    Registered Users, Registered Users 2 Posts: 3,992 ✭✭✭


    document.getElementById("balanceText").innerText = "111";
    and
    document.getElementById("balanceText").value = "111";

    Both Work grand in IE,

    But will not work in Chrome, FF, Opera or Safari.

    Google is being a bitch and not helping me much.. GAH !


Comments

  • Registered Users, Registered Users 2 Posts: 1,110 ✭✭✭Skrynesaver


    AFAIR the correct accessor is
    document.getElementById("balanceText").innerHTML = "111";
    


  • Registered Users, Registered Users 2 Posts: 3,992 ✭✭✭Korvanica


    sprted.. someone had changed the id field to name, and i didnt notice - (shared project).


  • Registered Users, Registered Users 2 Posts: 4,277 ✭✭✭km991148


    Although it appears that it turned out not to be a cross browser issue, you should consider a library such a jquery when working in JavaScript.

    you can then write statements such as $('#MY_ELEM_ID').html('MY_NEW_HTML');

    and not have to worry abouyt x browser compatibility as much.

    There are also many other benefits of such a library.


Advertisement
Advertisement