jQuery Tabs - Ajax version
I have my jquery ajax tabs running great. However I having problems getting/setting the content of an "input" on my selected Tab when the tab load.
This is what I have so far:
$("#开发者_StackOverflow中文版tabs").tabs({
load: function(event, ui) {
//$("#myinput").text('test');
$("#myinput").val('test'); <-- works
}
});
That's because an input's value is set with .val()
not .text()
.
$("#tabs").tabs({
load: function(event, ui) {
$("#myinput").val('test');
}
});
An input
doesn't have text()
, it has, instead, val()
, therefore try using:
$("#tabs").tabs({
load: function(event, ui) {
$("#myinput").val('test');
}
});
References:
text()
.val()
.
If I understand well you have to set #myinput as .val('test') not as .text('')
精彩评论