KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to alert a returned value from a function and I get this in the alert: [object Object] Here is the JavaScript code: <script type="text/javascript"> $(function () { var $main = $('#main'), $1 = $('#1'), $2 = $('#2'); $2.hide(); // hide div#2 when the page is loaded $main.click(function () { $1.toggle(); $2.toggle(); }); $('#senddvd').click(function () { alert('hello'); var a=whichIsVisible(); alert(whichIsVisible()); }); function whichIsVisible() { if (!$1.is(':hidden')) return $1; if (!$2.is(':hidden')) return $2; } }); </script> whichIsVisible is the function which I am trying to check on.
Tags (comma-separated)
Save Edits
Cancel