Reputation: 148
onclick event returns Jquery function I think its object window---
<a href="javascript:void(0);" onclick="update();">update</a>
function update()
{
var temp = $('#textareaid').html;
alert(temp);
}
returns---
function (a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fb,""):void 0;if(!("string"!=typeof a||mb.test(a)||!k.htmlSerialize&&gb.test(a)||!k.leadingWhitespace&&hb.test(a)||rb[(jb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ib,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ub(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)}
Upvotes: 0
Views: 203
Reputation: 3317
The get inner html function of jquery is .html
and if you want to execute the function do .html()
, so it returns the inner html. In your case, if you want to get the value of your textarea, use the jquery function .val()
Your modified code:
function update()
{
var temp = $('#textareaid').val();
alert(temp);
}
Here you can find the API of the jQuery .val() : http://api.jquery.com/val/ and the API of the jQuery .html() : http://api.jquery.com/html/
Short explanation:
In javascript you define a function like a variable:
var a = function(params) {
//do something
}
if you want to alert the value of this variable call alert(a);
and alert tries to display the value (you get the function-definition). To execute your function you have to call alert(a(params));
and here you can pass some parameter.
Upvotes: 1