带有关闭按钮的Kendo Tabstrip选项卡

时间:2015-07-01 09:18:11

标签: c# asp.net-mvc razor kendo-ui kendo-tabstrip

我有一个带有关闭按钮的kendo标签。问题是我无法通过按钮点击事件来关闭该标签。

 @(Html.Kendo().TabStrip()
  .Name("test")
  .Items(tabstrip =>
  {
     tabstrip.Add().Text("")
     .Selected(true)
     .ContentHtmlAttributes(new { style = "overflow: auto;" })
     .Content("");
  })
  .SelectedIndex(0)
  )

<script>
  tab.append({
    text: "" + name + " <input type='button' id='ddddd'>X</input> ",
    contentUrl: content,
    encoded: false
    //imageUrl: "/Images/close.png" <span class='tabdelete k-button'><span class=' k-icon k-i-close' ></span></span>
   })

 $("#ddddd").click(function () {
    alert("done");
 });
</script>

2 个答案:

答案 0 :(得分:1)

您的要求是this吗? http://jsfiddle.net/palanikumar/8jf2wpng/

$('.cls-btn').click(function()
{
    var index = $(this).parent().parent().index();
    var tabStrip = $('#tabstrip').getKendoTabStrip();
    tabStrip.remove(index);
    tabStrip.select(0);
});

答案 1 :(得分:0)

试试这个

<input type='button' class="button" id='ddddd'>X</input>


   <script type="text/javascript">
        $(function(){
             //replace your selector if u need ID
              //$('body').on('click', '#buttonID', function () {
            $('body').on('click', '.button', function () {

                alert('ddsda');
            });
        });
        </script>