How To Do Simple Wildcard Selection In jQuery

Author: , September 24th, 2010

Click here for the official jQuery Selectors documentation… jQuery(“input:radio[name^=foo]”) [code] <div id="test_1">Test One</div> <div id="test_2">Test Two</div> <div id="test_3">Test Three</div> [/code] Show all divs with an ID starting with “test”: [code]$("div[id^=test]").show();[/code] Hide any element that has an ID starting with “test”: [code]$("[id^=test]").hide();[/code] Another interesting approach I found was to use a filter. In the following example […]