i have an alert in fbjs which returns undefined but when i am comparing a fbjs variable with underined it does not work...
var params = document.getElementById('ques_form').serialize();
user_answer = params.radio;
if(user_answer=="undefined")
{
alert("please select any option");
return false;
}
or more correctly:
undefined is a "special" value in javascript, not the string with value "undefined". When you compare to "undefined" you are comparing if that variable is a string with the text "undefined" instead of checking for the special undefined value in javascript.
Learn: http://www.w3schools.com/jsref/jsref_undefined.asp http://javascript.about.com/od/reference/g/sundefined.htm