Tony33 Tony33 - 1 year ago 69
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;

Answer Source

You're not using the selector correctly, try:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download