The jQuery wildcard contains word
selector is used to filter out all the elements in a page, where the
specified attribute’s value contains the given word.
[<attribute name>~= <attribute value>]
In this post we shall see on how to use the jQuery wildcard contains selector to select all the elements in a page whose class attribute contains the word RedText
The following script lists out all the elements in a page whose class attribute contains the word RedText
[<attribute name>~= <attribute value>]
In this post we shall see on how to use the jQuery wildcard contains selector to select all the elements in a page whose class attribute contains the word RedText
The following script lists out all the elements in a page whose class attribute contains the word RedText
$("[class~='RedText']").each(function() {
alert('Wildcard
- Contains word:' + $(this).attr('id'));
});
The following script lists out all the elements in a page whose class attributes contains the word RedText on click of the btnWildcardSelector button.
$('#btnWildcardSelector).click(function(event) {
event.preventDefault();
//
// Wildcard - Contains word
The following script lists out all the elements in a page whose class attributes contains the word RedText on click of the btnWildcardSelector button.
$('#btnWildcardSelector).click(function(event) {
event.preventDefault();
//
// Wildcard - Contains word
$("[class~='RedText']").each(function() {
alert('Wildcard
- Contains word:' + $(this).attr('id'));
});
});
});
No comments:
Post a Comment