Tony33 Tony33 - 4 months ago 29
Javascript Question

javascript variable not populated correctly

Basically, the "rec" variable is correctly filled, but it's not happening with the "email" variable . Why?

This is my code:

<textarea id="q" name="q"></textarea>
<button onclick='alert(rec);'>
<a id="email" href="#" target="_blank">Email</a>
var rec;
var email;

rec = $('#q').val();
email = '' + rec;


You're not using the selector correctly, try: