I’m trying to get the content of the dt element using jquery.
var test_name = $('dt').text();
alert(test_name);
<dt> cycle_1 </dt>
This is not working. What I’m doing wrong? Meaning the alert message does not display.
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 the code to run after page loaded and all jQuery stuff. So, you use
$document.ready(/* some function containing your code */)for this. The shortcut for this is$(/* function */), then you pass your code in anonymous function (don’t have to name it).