I'm trying to use a wildcard to get the id of all the elements whose id begin with "jander". I tried $('#jander*')
, $('#jander%')
but it doesn't work..
I know I can use classes of the elements to solve it, but it is also possible using wildcards??
<script type="text/javascript">
var prueba = [];
$('#jander').each(function () {
prueba.push($(this).attr('id'));
});
alert(prueba);
});
</script>
<div id="jander1"></div>
<div id="jander2"></div>
$("[id*=jander]")
would select all elements with an ID containing the string jander. – Gourde