Richard77
Richard77

Reputation: 21661

how to select a button whose id contains a certain string?

How to select a button whose id contains a certain string? The reason I'm asking that is asp.net webform is adding the name of the container to the element's id.

$(document).ready(function () {
$('input[submit]:addNewRow').click(function(){
    //Do someting...
    });      
});

The id of the button contains AddNewRow.

Thanks for helping

Upvotes: 1

Views: 2766

Answers (1)

Jon
Jon

Reputation: 437754

Use the attribute value contains selector. If the id contains "AddNewRow", that would be

$("[id*='AddNewRow']")

Upvotes: 4

Related Questions