How do I concatenate a string with a variable?

前端 未结 5 1391
醉话见心
醉话见心 2020-11-22 16:26

So I am trying to make a string out of a string and a passed variable(which is a number). How do I do that?

I have something like this:

function AddB         


        
5条回答
  •  醉话见心
    2020-11-22 17:25

    It's just like you did. And I'll give you a small tip for these kind of silly things: just use the browser url box to try js syntax. for example, write this: javascript:alert("test"+5) and you have your answer. The problem in your code is probably that this element does not exist in your document... maybe it's inside a form or something. You can test this too by writing in the url: javascript:alert(document.horseThumb_5) to check where your mistake is.

提交回复
热议问题