0

キーダウンとフォーカスアウトメソッドを単一のjspで実装しようとしています..次の要件を満たす必要があります..

要件:

  1. (keyDown) > ユーザーがテキスト ボックスに「4 つ以上の文字」(つまり製品名) を入力すると、ポップアップ ウィンドウが開き、テキスト ボックスに入力した関連製品名を表示する必要があります。

  2. (フォーカスアウト) > ユーザーが正確な製品名 (7 文字または 8 文字の場合があります) を入力してフォーカスアウトを行うと、正確な製品名を取得する必要があります..

だから私はこの2つのことを実装し、以下の私のコードを見てください..

        $("productName").keydown(function()
        {

           //when productName.length >4 i have show the pop up and show the related productName in that code..
          //passing greater than 4 character to ajax and and retriving related products from ajax response.. and showing in the pop up

        }

       $("productName").focusout(fuction()
        {
           //when the user entering exact product name(it may be 7 character or 8 character) and make a focusout and have the pass the value to ajax and have retrieve exact productName details from the ajax response
        }

直面した問題

  • 正確な製品名 (6 文字または 7 文字) を入力しようとすると、4 文字を超えているため、キーダウンが呼び出されます..

では、どうすればこれらのことを克服できますか..この2つの要件は一度に満たすことができますか?

この問題から私を助けてください

4

1 に答える 1