How do I put a variable name inside an li tag?
For exmaple,
var test_name = $('dt').text();
$('#test_div').html('<li> test_name </li>');
This is not working. What am I doing wrong here. It displays test_name not the value of test_name.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need to build a string containing your value:
Note that this is an XSS hole; you need to escape the HTML.
You can do that by building an element with jQuery: