How to get all html elements with a fixed start string


I have many html elements with id like


and many more


how to get all the elemnts using jquery?

You can use the following :

this will get all elements starting with demo


Selector documentation here

Iterate over them using each() ->

$("[id^=demo]").each(function(index) {
    alert(index + ': ' + $(this).text());

each documentation here