Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Quick Cross Browser JS question

Options
  • 10-10-2011 12:48pm
    #1
    Registered Users 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 Posts: 1,109 ✭✭✭Skrynesaver


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


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


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


  • Registered Users Posts: 4,275 ✭✭✭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