开发者

Problem creating jquery-ui tabs

开发者 https://www.devze.com 2023-01-30 06:26 出处:网络
I need to create tabs dynamically based on db results, but since I am just starting to learn jquery and UI, I thought of creating something simple first.

I need to create tabs dynamically based on db results, but since I am just starting to learn jquery and UI, I thought of creating something simple first.

basically I am starting with three tabs initially, and trying to add another through jquery

<div id="tabs">
        <ul>
      <li><a href="#tabs-1">Nunc tincidunt</a></li>
      <li><a href="#tabs-2">Proin dolor</a></li>
      <li><a href="#tabs-3">Aenean lacinia</a></li>
     </ul>
     <div id="tabs-1">
      <p>Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.</p>
     </div>
     <div id="tabs-2">
      <p>Morbi tincidunt, du开发者_StackOverflow中文版i sit amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc. Duis scelerisque molestie turpis. Sed fringilla, massa eget luctus malesuada, metus eros molestie lectus, ut tempus eros massa ut dolor. Aenean aliquet fringilla sem. Suspendisse sed ligula in ligula suscipit aliquam. Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas feugiat, tellus pellentesque pretium posuere, felis lorem euismod felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et purus.</p>
     </div>
     <div id="tabs-3">
      <img src="content/user_avatars/User_full_blank.jpg" width="200px" height="300px"/>
     </div>

    </div>

As you can see, I simply tried creating a list item in the ul, before calling the tabs method.

$(function(){
    $('#tabs ul').append('<li><a href="login.php"><span>New Tab<span></a></li>');
    $('#tabs').tabs();
})

This worked great in firefox, but in IE, I see "New Tab" appear as simple text beside the three initial tabs, it is not stylised or clickable or anything.... any help?


I don't think IE likes the span inside of the anchor.

This works:

$(function(){
    $('#tabs ul').append('<li><a href="login.php">New Tab</a></li>');
    $('#tabs').tabs();
});
0

精彩评论

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

关注公众号