开发者

jQuery Tabs - Ajax version

开发者 https://www.devze.com 2023-03-31 18:25 出处:网络
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.

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('')

0

精彩评论

暂无评论...
验证码 换一张
取 消