HomeHome  
  • WelcomeWelcome  
  • Events  
  • PublicationsPublications  
  • FAQFAQ  
  • SearchSearch  
  • MemberlistMemberlist  
  • UsergroupsUsergroups  
  • RegisterRegister  
  • Log inLog in  
  • You are not connected. Please login or register


    Replace text in javascript

    avatar
    • *****


        Reputation : 11
        Registered on : 2014-04-25
        Posts : 153
        Love Fmcodes
      Hi, i have a problem with a replacement in a javascript code.

      The javascript code is this one:



      u see that the second line 
      Code:
      .replace(/HTML/g,"<span id='HTML'>HTML</span>

      With this code, the text "HTML" is getting replaced by second word "HTML" which is in the span id.
      I want to replace the text "[HTML]" (without quotes). I tried this one:
      Code:
      .replace(/[HTML]/g,"<span id='HTML'>HTML</span>

      but something is not correct so i get this result:


      which is the correct code in order to replace 
      Code:
      [HTML]



      ??

      avatar
      • *****


          Reputation : 11
          Registered on : 2014-04-25
          Posts : 153
          Love Fmcodes
        okey guys i have found the solution and u can lock the topic.

        Code:
        replace(/\[HTML\]/g

        avatar
        • Support Moderator

            Reputation : 8
            Registered on : 2014-03-11
            Posts : 299
            Helping on the forum
          Hello

          as this topic is solved it is locked and moved to the sub-section Solved issues

          Thanks,
          and hope to see you soon again on fmcodes



          FMCodes Support Moderator

          I am very active now! Feel free to PM me anytime.


          YOUR BANNER HERE
          728x90
          DMCA.com Protection Status
          © PunBB | Contact | Report an abuse