Select a SharePoint WebPart Item with jQuery

Kode i .ascx file:

<asp:Label ID="lblSomeLabel" runat="server"></asp:Label>

Kode i endelig html:

<span id="ctl00_m_g_6fb87798_677a_4b2e_804d_6cb23c3672d1_ctl00_lblSomeLabel"></span>

Så hvordan fanger man elementet fra JavaScript?

  "use strict";
  var $lblSomeLabel = $("[id$='_lblSomeLabel']");

Læs mere på

Attribute Ends With Selector [name$=”value”]

Skriv et svar

This site uses Akismet to reduce spam. Learn how your comment data is processed.