Search code examples
asp.netjquerymaster-pagesfindelement

jquery: find element whose id has a particular pattern


I am trying to find a span element who has an id in a particular pattern. Its main use is to find certain elements rendered by an asp.net (aspx) page which is derived from a master page.


Solution

  • $('span').each(function(){
       if( $(this).attr('id').match(/pattern/) ) {
            // your code goes here
       }
    });
    

    problem solved.