文字列内の変数を使用したいと思います。私は何度もやろうとしましたが、変数名を取得するだけです。jqueryの変数stringをjqueryで使用する方法
<head>
<script type="text/javascript" src="jquery-1.7.2.js"></script>
<script type="text/javascript">
$(function(){
$("a").click(function(){
var id= $(".id").html();
$('.html').html("<div class='new' id=+id+>jitender</div>")
});
});
</script>
</head>
<body>
<div class="wrap">
<a href="#">Make Html</a>
<div class="html"></div>
<div class="id">first</div>
</div>
</body>
uはplsは私に言うことができるトリックや方法これは、文字列の連結である – Carlos
@amitが何でありますか。あなたは[** MDN **](https://developer.mozilla.org/ja/JavaScript/Reference/Operators/String_Operators)で読むことができます。 – VisioN
任意のデータをHTMLに直接連結しないでください。あなたは何かをエスケープしているわけではなく、無効なHTMLやインジェクションの問題にあなた自身を巻き込んでいます。 – Brad