Jquery Show Input Text Based On Input Value

前端 未结 5 1413
感动是毒
感动是毒 2021-01-21 05:35

I facing problem with my jquery, on showing input text based on input value. Here is the JS fiddle demo :

http://jsfiddle.net/Ltapp/364/

When I try to input @hot

5条回答
  •  没有蜡笔的小新
    2021-01-21 05:43

    It's because your selector $("input") affects both input elements. I have updated it to the $("input:first") selector instead. JsFiddle here

        $("input:first").keyup(function () {
        var value = $(this).val();
        if(value.match(myString)) {
            $('#hotm').show();
        } else {
            $('#hotm').hide(); 
        }
    });
    

提交回复
热议问题