Need some help with jQuery syntaxes,
I'm trying to do some kind of a search function in my form, it is working now with following code
<script>
jQuery(document).on('keypress', '[id*="fieldname2_"]', function(){
jQuery(".cff-container-field").hide();
jQuery(".cff-container-field legend:contains('"+jQuery("[id*='fieldname2']").val()+"')").parent().parent().show()
});
What i need to do is to make both ".cff-container-field legend" and "[id*='fieldname2']").val()
not case sensitive and normalize characters like č,ť,ä,ô...
i managed to normalize a string with
normalize('NFD').replace(/[\u0300-\u036f]/g, '')
but i don't know how to integrate it in existing jQuery above + to capitalize
Can anybody give some guidance or help with code?
Total newbie in JS)
here some more info about CFF plugin
Customizing the form
Resolved with custom "contains" function
<script>
jQuery.expr[':'].icontains = function(a, i, m) {
return jQuery(a).text().normalize("NFD").replace(/[\u0300-\u036f]/g, "").toUpperCase()
.indexOf(m[3].normalize("NFD").replace(/[\u0300-\u036f]/g, "").toUpperCase()) >= 0;
};
jQuery(document).on('keyup', '[id*="fieldname2_"]', function(){
jQuery(".cff-container-field").hide();
jQuery(".cff-container-field legend:icontains('"+jQuery("[id*='fieldname2']").val()+"')").parent().parent().show();
});
</script>