Skip to content
Advertisement

how to alert javascript object [duplicate]

I am trying to study the jquery class, but I have a hard time debugging an object because I can’t see the element inside of it

$("#birds").autocomplete({
    source: "search.php",
    select: function (event, ui) {
        alert(ui);
    }
});

it returns [object Object].. 🙁 My question is how can I alert the object so that I can see the element?

Advertisement

Answer

i recommend you use FireBug for debugging javascript. then you can just do

console.log(ui) 

and it’ll log the object in a form you can expand

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement