On server side, I generate some div with these IDS, for example :
<div id="ContentPlaceBody_Example_localita_168">Hello</div>
<div id="ContentPlaceBody_Example_localita_80">my name is</div>
<div id="ContentPlaceBody_Example_localita_740">Marco</div>
so, on client side, Id like to select these IDS checking the last part of the ID (that is fixed, can’t change, _localita_UNIQUEID). Such as :
var myID = "80";
$('# HERE THE SELECTOR I NEED _localita_'+myID).hide();
is there a fast way?
Use ends with selector: http://api.jquery.com/attribute-ends-with-selector/
Try this:
Update:
@raina77ow ‘s comment made me dig more and here’s an alternatives to make it better.
(Refer to the excellent post on this: http://encosia.com/11-keystrokes-that-made-my-jquery-selector-run-10x-faster/)
Give a class name to the divs (e.g: “endswith”) you need to query by ends with and then use this version to make it perform better: