use expression at the selector javascript

If you’re finding by Contains then it’ll be like this

    $("input[id*='DiscountType']").each(function (i, el) {
         //It'll be an array of elements
     });

If you’re finding by Starts With then it’ll be like this

    $("input[id^='DiscountType']").each(function (i, el) {
         //It'll be an array of elements
     });

If you’re finding by Ends With then it’ll be like this

     $("input[id$='DiscountType']").each(function (i, el) {
         //It'll be an array of elements
     });

If you want to select elements which id is not a given string

    $("input[id!='DiscountType']").each(function (i, el) {
         //It'll be an array of elements
     });

If you want to select elements which id contains a given word, delimited by spaces

     $("input[id~='DiscountType']").each(function (i, el) {
         //It'll be an array of elements
     });

If you want to select elements which id is equal to a given string or starting with that string followed by a hyphen

     $("input[id|='DiscountType']").each(function (i, el) {
         //It'll be an array of elements
     });

tableau en javascripte

la clé de tableau doit être en type interger, sinon, le longueur de tableau ne va pas être renseigné .

var person = [];
person[“firstName”] = “John”;
person[“lastName”] = “Doe”;
person[“age”] = 46;
var x = person.length;         // person.length will return 0
var y = person[0];             // person[0] will return undefined

le lib DataTable

Si on veut ajouter les events sur tous les elements de table, il faut ajouter avant qu’on fait le draw.

un example :

table_liste_numero = $(‘#table_numero’).DataTable();

$(“.numero_rub”).on(‘click’, function() {
console.log(‘test’)
});

if (id_numero) {
table_liste_numero.search( ‘test’ ).draw();
}

ajouter le listening click sur tous les elements “.numero_rub”, si on met la searche avant, on ne va  qu’ajouter le listening sur les elements ‘test’ !