views:

158

answers:

1
if($(currentTab+' form.dataform').attr('name') !== undefined)
    var $selectedTab = $(currentTab+' form.dataform').attr('name');
else  
var selectedTab = '0';

alert($(selectedTab)); Gives me an object. I need string. How?

+1  A: 

Drop the $() around the selectedTab, and remove the $ from the variable definition.

if($(currentTab+' form.dataform').attr('name') !== undefined)
    var selectedTab = $(currentTab+' form.dataform').attr('name');
else  
    var selectedTab = '0';

alert(selectedTab);
acrosman
Thanks, and one more thing: var $selectedTab >> var selectedTab
I actually did say that, but not clearly. I'll edit to improve clarity.
acrosman