Getting span title on document ready not working in kendo tab strip












0















I have kendo tab strip for kendo grid row and its uses a partial view. It displays an image if it is available. Now I want to display a default image if no image is available. Images are available in form of url.



I was trying to achieve it via document ready event for the tab strip. Lately I have added a span with title to see if I am able to get the value and apply the logic but it is not working.The span with




data-bind="attr:{title:ImgLink}




doesn't give any value.
However when I am put the default span title I am able to get the value.



Code below:
1. TAB STRIP



@(Html.Kendo().TabStrip()
.Name("tabStrip_#=SeriesId#")
.SelectedIndex(0)
.Animation(animation => animation.Open(open => open.Fade(FadeDirection.In)))
.Items(items =>
{
items.Add().Text("Catalog Links")
.Selected(true)
.Content(@<text>
@(Html.Partial("Catalogs", new CatalogModel()))

</text>);
})
.ToClientTemplate()
)
<script>
function onDetailInit(e) {
kendo.bind(e.detailCell.find('form'), JSON.parse(JSON.stringify(e.data.Catalogs)));

}
</script>


2 Partial View



<form>
@using (Ajax.BeginForm("Catalogs", "Series", null, new AjaxOptions { HttpMethod = "POST", OnSuccess = "OnSuccess", OnFailure = "OnFailure" }))
{
<div id="Desc">
<div class="property">
<label> @(Html.LabelFor(m => m.ImgLink)) </label>
</div>

<div class="value" id="headspan">

<a id="L3" target="_blank" href="" data-bind="attr:{href:ImgLink}"><img src="~/Content/images/pdf.jpg" /></a>
<span id="spanLink" data-bind="attr:{title:ImgLink}"></span>
<span id="spanLink2" title="DefaultLink"></span>

</div>
</div>
}
</form>


3 Jquery



<script>
$(document).ready(function () {
debugger;
alert($(this).find("\#spanLink").attr("title")); // this does not work
alert($(this).find("\#spanLink2").attr("title")); // this works
})
</script>



  1. Here is how the spans appear in developers tools.


enter image description here



Kindly Help. Thanks.










share|improve this question



























    0















    I have kendo tab strip for kendo grid row and its uses a partial view. It displays an image if it is available. Now I want to display a default image if no image is available. Images are available in form of url.



    I was trying to achieve it via document ready event for the tab strip. Lately I have added a span with title to see if I am able to get the value and apply the logic but it is not working.The span with




    data-bind="attr:{title:ImgLink}




    doesn't give any value.
    However when I am put the default span title I am able to get the value.



    Code below:
    1. TAB STRIP



    @(Html.Kendo().TabStrip()
    .Name("tabStrip_#=SeriesId#")
    .SelectedIndex(0)
    .Animation(animation => animation.Open(open => open.Fade(FadeDirection.In)))
    .Items(items =>
    {
    items.Add().Text("Catalog Links")
    .Selected(true)
    .Content(@<text>
    @(Html.Partial("Catalogs", new CatalogModel()))

    </text>);
    })
    .ToClientTemplate()
    )
    <script>
    function onDetailInit(e) {
    kendo.bind(e.detailCell.find('form'), JSON.parse(JSON.stringify(e.data.Catalogs)));

    }
    </script>


    2 Partial View



    <form>
    @using (Ajax.BeginForm("Catalogs", "Series", null, new AjaxOptions { HttpMethod = "POST", OnSuccess = "OnSuccess", OnFailure = "OnFailure" }))
    {
    <div id="Desc">
    <div class="property">
    <label> @(Html.LabelFor(m => m.ImgLink)) </label>
    </div>

    <div class="value" id="headspan">

    <a id="L3" target="_blank" href="" data-bind="attr:{href:ImgLink}"><img src="~/Content/images/pdf.jpg" /></a>
    <span id="spanLink" data-bind="attr:{title:ImgLink}"></span>
    <span id="spanLink2" title="DefaultLink"></span>

    </div>
    </div>
    }
    </form>


    3 Jquery



    <script>
    $(document).ready(function () {
    debugger;
    alert($(this).find("\#spanLink").attr("title")); // this does not work
    alert($(this).find("\#spanLink2").attr("title")); // this works
    })
    </script>



    1. Here is how the spans appear in developers tools.


    enter image description here



    Kindly Help. Thanks.










    share|improve this question

























      0












      0








      0








      I have kendo tab strip for kendo grid row and its uses a partial view. It displays an image if it is available. Now I want to display a default image if no image is available. Images are available in form of url.



      I was trying to achieve it via document ready event for the tab strip. Lately I have added a span with title to see if I am able to get the value and apply the logic but it is not working.The span with




      data-bind="attr:{title:ImgLink}




      doesn't give any value.
      However when I am put the default span title I am able to get the value.



      Code below:
      1. TAB STRIP



      @(Html.Kendo().TabStrip()
      .Name("tabStrip_#=SeriesId#")
      .SelectedIndex(0)
      .Animation(animation => animation.Open(open => open.Fade(FadeDirection.In)))
      .Items(items =>
      {
      items.Add().Text("Catalog Links")
      .Selected(true)
      .Content(@<text>
      @(Html.Partial("Catalogs", new CatalogModel()))

      </text>);
      })
      .ToClientTemplate()
      )
      <script>
      function onDetailInit(e) {
      kendo.bind(e.detailCell.find('form'), JSON.parse(JSON.stringify(e.data.Catalogs)));

      }
      </script>


      2 Partial View



      <form>
      @using (Ajax.BeginForm("Catalogs", "Series", null, new AjaxOptions { HttpMethod = "POST", OnSuccess = "OnSuccess", OnFailure = "OnFailure" }))
      {
      <div id="Desc">
      <div class="property">
      <label> @(Html.LabelFor(m => m.ImgLink)) </label>
      </div>

      <div class="value" id="headspan">

      <a id="L3" target="_blank" href="" data-bind="attr:{href:ImgLink}"><img src="~/Content/images/pdf.jpg" /></a>
      <span id="spanLink" data-bind="attr:{title:ImgLink}"></span>
      <span id="spanLink2" title="DefaultLink"></span>

      </div>
      </div>
      }
      </form>


      3 Jquery



      <script>
      $(document).ready(function () {
      debugger;
      alert($(this).find("\#spanLink").attr("title")); // this does not work
      alert($(this).find("\#spanLink2").attr("title")); // this works
      })
      </script>



      1. Here is how the spans appear in developers tools.


      enter image description here



      Kindly Help. Thanks.










      share|improve this question














      I have kendo tab strip for kendo grid row and its uses a partial view. It displays an image if it is available. Now I want to display a default image if no image is available. Images are available in form of url.



      I was trying to achieve it via document ready event for the tab strip. Lately I have added a span with title to see if I am able to get the value and apply the logic but it is not working.The span with




      data-bind="attr:{title:ImgLink}




      doesn't give any value.
      However when I am put the default span title I am able to get the value.



      Code below:
      1. TAB STRIP



      @(Html.Kendo().TabStrip()
      .Name("tabStrip_#=SeriesId#")
      .SelectedIndex(0)
      .Animation(animation => animation.Open(open => open.Fade(FadeDirection.In)))
      .Items(items =>
      {
      items.Add().Text("Catalog Links")
      .Selected(true)
      .Content(@<text>
      @(Html.Partial("Catalogs", new CatalogModel()))

      </text>);
      })
      .ToClientTemplate()
      )
      <script>
      function onDetailInit(e) {
      kendo.bind(e.detailCell.find('form'), JSON.parse(JSON.stringify(e.data.Catalogs)));

      }
      </script>


      2 Partial View



      <form>
      @using (Ajax.BeginForm("Catalogs", "Series", null, new AjaxOptions { HttpMethod = "POST", OnSuccess = "OnSuccess", OnFailure = "OnFailure" }))
      {
      <div id="Desc">
      <div class="property">
      <label> @(Html.LabelFor(m => m.ImgLink)) </label>
      </div>

      <div class="value" id="headspan">

      <a id="L3" target="_blank" href="" data-bind="attr:{href:ImgLink}"><img src="~/Content/images/pdf.jpg" /></a>
      <span id="spanLink" data-bind="attr:{title:ImgLink}"></span>
      <span id="spanLink2" title="DefaultLink"></span>

      </div>
      </div>
      }
      </form>


      3 Jquery



      <script>
      $(document).ready(function () {
      debugger;
      alert($(this).find("\#spanLink").attr("title")); // this does not work
      alert($(this).find("\#spanLink2").attr("title")); // this works
      })
      </script>



      1. Here is how the spans appear in developers tools.


      enter image description here



      Kindly Help. Thanks.







      jquery asp.net-mvc kendo-asp.net-mvc kendo-tabstrip






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 23 '18 at 8:15









      Ankit KumarAnkit Kumar

      2172819




      2172819
























          0






          active

          oldest

          votes












          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53442855%2fgetting-span-title-on-document-ready-not-working-in-kendo-tab-strip%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53442855%2fgetting-span-title-on-document-ready-not-working-in-kendo-tab-strip%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          Xamarin.form Move up view when keyboard appear

          Post-Redirect-Get with Spring WebFlux and Thymeleaf

          Anylogic : not able to use stopDelay()