jquery get only all html elements with ids

$('[id]') returns all elements that have id set


You can use the following syntax to limit the results:

$('input[id*=test_id]').live('click', callbackFunc());

or

$('.elements_set[id*=test_id]').live('click', callbackFunc());

or in same manner

$('input[name*=test_id]').live('click', callbackFunc());

These are called Attribute Selectors

Reference links:

  • Attribute Contains Selector [name*="value"]
  • Attribute Contains Word Selector [name~="value"]
  • Attribute Ends With Selector [name$="value"]
  • Attribute Not Equal Selector [name!="value"]
  • Attribute Starts With Selector [name^="value"]