Why is the val() function returning [object Object]?
jquery
Solution
$('#error').val('Please select Activity');
should be
$('#error').text('Please select Activity');
Or
$('#error').html('Please select Activity');
alert( $('#error').text() ); // or $('#error').html()
Because, `.val()` is for `input, textarea` controls, so you need `.text()` or `.html()`.
Problem
Html code: ``` <div data-role="popup" id="popup-activity"> <div data-role="header"> <h1>Error</h1> </div> <div data-role="content" data-theme="d" class="ui-corner-bottom ui-content"> <h3 id="error" class="ui-title"></h3> </div> </div> ``` Jquery: ``` $('#error').val('Please select Activity'); alert($('#error')); $('#popup-activity').popup("open"); ``` Hi i'm new to jquery. I'm using jquery.mobile-1.2.0-alpha.1.js which allows popups as in the above description. When I open the popup the value in the error id does not show up. In fact it shows empty. So I've put an alert box to see its value which says [object Object]. Does anyone know how to display the text in the popup?