Ive created a dropdown box dynamically getting datea from a database but when I try to get (or set) the first value, it always says undefined.
Ive tried something like:
$j("#mydiv").val(1);
var somevariable = $j("#mydiv").val();
console.log ("print it out " + somevariable);
And it says
print it out undefined
If I add a alert it works. Seems to be because of a delay so I how can I get it to work? Thank you.