Click here to Skip to main content
15,900,457 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have to concate string like below.

var number = 100;
var tmp = "$$myText" + number + "$$";
alert(tmp);


but, tmp contains BLANK value.

In case, I write like;

var number = 100;
var tmp = "myText" + number;
alert(tmp);


then tmp contains "myText100".

I believe the problem is with $$.

Any suggestion will be helpful...

Thanks.
Posted
Comments
shakil0304003 9-Nov-10 10:24am    
which browser, you faced problem?

If you would paste that code in the "try it yourself" editor of w3cschool it works fine. Sure this is the code that goes wrong?

http://www.w3schools.com/js/tryit.asp?filename=tryjs_formattext[^]

Good luck!
 
Share this answer
 
It's working fine in my Machine.

I think you may have another problem.

Here is my full code

JavaScript
function clicked() {
            debugger;
            var number = 100;
            var tmp = "$$myText" + number + "$$";
            alert(tmp);
        }



<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="clicked();" />


It's giving alert of $$myText100$$

Check you may have browser specific problem.

Please vote and Accept Answer if it Helped.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900