Results 1 to 4 of 4
  1. #1
    manik's Avatar
    manik is online now Om Shanti!
    Join Date
    Apr 2008
    Location
    Boston, USA
    Posts
    13,176
    Thanks
    744
    Thanked 701 Times in 550 Posts
    Blog Entries
    4
    Feedback Score
    4 (100%)

    Default innerText Does Not Work on FireFox

    If you happen to try use the JavaScript property innerText on an element you wont get it work with FireFox browser.

    The reason is FireFox does not have a property innerText, rather they use a property called textContent.

    There are many ways to solve this problem.

    Option 1:
    Use JQuery.
    Example:
    $(document).ready(function() {
    $('myElementId').text("My Text or Whatever");
    });

    Option 2:
    Create a JavaScript function, and call it when you need.

    function ChangeContent(elem, content) {
    if (document.all)
    elem.innerText = content;
    else
    elem.textContent = content;
    }

    There are many other ways as well.
    Free Classified Ads & BUSINESS/PROFESSIONAL SOCIAL NETWORK


  2. #2
    mahesh2010 is offline Banned
    Join Date
    Jun 2010
    Location
    USA
    Posts
    194
    Thanks
    0
    Thanked 1 Time in 1 Post
    Feedback Score
    0

    Default

    Quote Originally Posted by manik View Post
    If you happen to try use the JavaScript property innerText on an element you wont get it work with FireFox browser.

    The reason is FireFox does not have a property innerText, rather they use a property called textContent.

    There are many ways to solve this problem.

    Option 1:
    Use JQuery.
    Example:
    $(document).ready(function() {
    $('myElementId').text("My Text or Whatever");
    });

    Option 2:
    Create a JavaScript function, and call it when you need.

    function ChangeContent(elem, content) {
    if (document.all)
    elem.innerText = content;
    else
    elem.textContent = content;
    }

    There are many other ways as well.
    Hi,
    these two are best way of solving the problem
    though there are lot of ways to solve it
    thanks for sharing

  3. #3
    jacobatwood is offline Sophomore
    Join Date
    Mar 2011
    Posts
    90
    Thanks
    0
    Thanked 1 Time in 1 Post
    Feedback Score
    0

    Default

    Yes, this works. Almost all browsers support this.

  4. #4
    mandy is offline Junior
    Join Date
    Apr 2011
    Posts
    332
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Feedback Score
    0

    Default

    Yes these are really easy for solving these types of problem,thanks a lot for sharing your knowledge...............

Similar Threads

  1. Replies: 12
    Last Post: 10-25-2011, 08:41 AM
  2. Add-ons for Firefox
    By BrainPulse in forum Search Engine Optimization
    Replies: 14
    Last Post: 06-29-2009, 01:39 AM
  3. IE Vs Firefox
    By Amit.Verma in forum General Talk
    Replies: 16
    Last Post: 03-04-2009, 07:29 PM
  4. 30 FireFox Add Ons to do just about anything
    By himoacs in forum All Other Search Engines
    Replies: 3
    Last Post: 11-11-2008, 07:05 AM
  5. FireFox 3 or Opera 9.5?
    By Amirmullick3 in forum All Other Search Engines
    Replies: 3
    Last Post: 07-23-2008, 06:44 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Partners: BOSTON WEB DEVELOPER, LLC   |   WEBCOSMO CLASSIFIEDS