12
I need to check if there is a specific piece within an excerpt of a javascript word.
For example, my word is John, I need to check if Jo contains inside her.
I tried to do it with the index but it didn’t work with the match but it didn’t work.
//pesquiso tudo que tem dentro dessa classe
$(".form-group").find('*').each(function() {
var cont = 0;
//pego todos os ids
var id = $(this).attr("id");
//verifico se o trecho especifico contem o que eu preciso
if (id.match("txtOutrosNomes") != -1) {
console.log(cont++);
}
});
How to make this comparison?
What’s inside
url
?– bio
ops, is id instead of url
– gabrielfalieri
Good, but what exactly appears in
id
? It seems pretty simple what you want to do, the index, the match or even a Regex should work. Maybe it’s another problem...– bio
Appears something like "txtOutrosNomes2", "txtOther"
– gabrielfalieri