SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    Designer/Developer FarooqAzam's Avatar
    Join Date
    May 2004
    Location
    Pakistan
    Posts
    217
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    (textarea.value += 'xxxxxx') not working on Firefox

    I am new to Javascript and i am stuck in this:-

    Code:
    // When you click it, it will add "testing" to the textarea.
    <a href="#" onClick="text.value += 'testing';">Add Testing</a><br />
    
    // Heres the textarea.
    <textarea name="text" cols="53" rows="15" id="text"></textarea>
    It works well on IE, but didn't work on Firefox .

    Any ideas please?

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <textarea id="targetTa" name="text" cols="53" rows="15" id="text"></textarea>

    onclick="document.getElementById('targetTa').value += 'testing' "

  3. #3
    SitePoint Addict
    Join Date
    Aug 2006
    Posts
    266
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My beautiful,
    You can use this
    Code:
     
    <html>
    <head> 
    <script type="text/javascript">
    
    function FarooqAzam () {
    
    var el = document.getElementById('text');
    
    el.value = el.value + "testing" ;
    
    }
    </script>
    </head>
    <body>
    
    <a href="#" onClick="FarooqAzam ()">Add Testing</a><br />
    
    <textarea name="text" cols="53" rows="15" id="text"></textarea>
    
    </body>
    </html>
    or this
    Code:
      
    <a href="#" onClick="document.getElementById('text').value = document.getElementById('text').value +'testing'  ">Add Testing</a><br />
    
    <textarea name="text" cols="53" rows="15" id="text"></textarea>
    or this
    Code:
      
    <a href="#" onClick="document.getElementById('text').value += 'testing'  ">Add Testing</a><br />
    
    <textarea name="text" cols="53" rows="15" id="text"></textarea>
    Ayşe
    Last edited by muazzez; Apr 20, 2007 at 12:13.

  4. #4
    Designer/Developer FarooqAzam's Avatar
    Join Date
    May 2004
    Location
    Pakistan
    Posts
    217
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Muazzez:- Thanks alot. I've used your code and my problem is fixed! Thanks again.

    7stud:- Thanks to you too.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •