I need to fade items from an array in and out continuously and I'm currently doing it as such:
var rotateHint = function() {
var hints = ['fe','fi','fo','fum'];
var hint;
var p = (function() {
if (!hint || !hint.length) hint = hints.slice();
return hint.splice(Math.random() * hint.length | 0, 1);
}())
$('#hint').text(p) //THE ERROR IS HERE...
.fadeIn()
.delay(1000)
.fadeOut(200,function(){
rotateHint();
})
};
However it seems that .text(p) isn't working however if I look at p with an alert(p) the output is sound.
#hint? Have you tried usinghtml()instead oftext()instead?