Basically we have pattern to match with ID in jquery .
1) That selector matches all Button that have an
$('input[id^="Test"]').css('background-color', 'red');
2) That selector matches all Button that have an
$('input[id$="Test"]').css('background-color', 'red');
3) That selector matches all Button that have an
$('input[id*="Test"]').css('background-color', 'red');
1) That selector matches all Button that have an
id attribute and it starts with "Test"$('input[id^="Test"]').css('background-color', 'red');
2) That selector matches all Button that have an
id attribute and it ends with "Test".$('input[id$="Test"]').css('background-color', 'red');
3) That selector matches all Button that have an
id attribute anywhere with "Test" id.$('input[id*="Test"]').css('background-color', 'red');
Ex -> <asp:Button ID="Test" runat="server" Text="Button" />
<asp:Button ID="Test1" runat="server" Text="Button1" />
<asp:Button ID="Test2" runat="server" Text="Button2" />
<asp:Button ID="NotTest3" runat="server" Text="Button3" OnClick="Button1_Click" OnClientClick="return test();"/>
Output for 1 , 2 and 3 Pattern)
No comments:
Post a Comment