How is search to a selector for find a value by jQuery?

how is search to a selector for find a value by jQuery?

Do you mean an element with a certain value for a certain attribute?


$('input[value="foo"]')

This will find all inputs with value=“foo”.

More info: Selectors – jQuery API

i want a value( $(“#hotel”).val(); ) search to some of selector(.list_name p):


var strToMatch = $("#hotel").val();
$('.list_name p').each(function () {
            if (this.innerHTML.indexOf(strToMatch) > -1) {
                $(this).show();
                if($('#hotel').val()==""){
                    $('.list_name p').hide()
                }                
            } else {
                $(this).hide();
            }
        });

this:


this.innerHTML.indexOf(strToMatch) > -1

how is with jQuery?

The jQuery selectors page shows one called :contains() which seems like it should do the job for you.