-1

誰か助けてください。

以下の選択リストがあります。

<td>Call Lead Type: </td>
<td>
    <select name="CallLeadType" id="CallLeadType">
        <option value=""></option>
        <option value="LSG Service warm transfer from Claims">LSG Service warm transfer from Claims</option>
        <option value="IVR Direct Call">IVR Direct Call</option>
        <option value="Transfer from EE Agent">Transfer from EE Agent</option>
        <option value="Dropped Line">Dropped Line</option>
        <option value="Test Call from EE">Test Call from EE</option>
    </select>
</td>

ユーザーが「EE Agent からの転送」を選択すると、4 つの新しい入力ボックスが表示される必要がありますが、他のオプションが選択されている場合は表示されませんか?

だから私はそれが必要なonchangeコードだと思いますか?

方法がわからない

よろしくお願いいたします。

パダーズ

4

7 に答える 7

1

あなたはjqueryを使うことができます

$('select[name=CallLeadType]').on('change',function(){

 if ( $(this).val() == 'Transfer from EE Agent' )
{
//create inputs here
}

});
于 2013-05-14T12:10:28.217 に答える
0
<td>Call Lead Type: </td>
<td>
    <select name="CallLeadType" id="CallLeadType">
        <option value=""></option>
        <option value="LSG Service warm transfer from Claims">LSG Service warm transfer from Claims</option>
        <option value="IVR Direct Call">IVR Direct Call</option>
        <option value="Transfer from EE Agent">Transfer from EE Agent</option>
        <option value="Dropped Line">Dropped Line</option>
        <option value="Test Call from EE">Test Call from EE</option>
    </select>
    <input type="text" class="transferInput"/>
    <input type="text" class="transferInput"/>
</td>

$(function(){
    $('.transferInput').hide();

    $('#CallLeadType').on('change', function(){
        $('.transferInput').hide();
        if ( $('#CallLeadType').val() == 'Transfer from EE Agent' ){
                 $('.transferInput').show();
          }
    });
});
于 2013-05-14T12:18:20.110 に答える
0
$('#CallLeadType').live("change",function(){
   var Id=document.getElementById("CallLeadType");
   var value = Id.options[Id.selectedIndex].text;

   if(value=="Transfer from EE Agent"){

  // your code to add textboxes
}
});
于 2013-05-14T12:11:21.977 に答える
0

基本的に、要素「select」の値を変更したときにトリガーできるイベント(.change) と、selectの現在の値を取得できる疑似クラス(:selected) の 2 つが必要です。 「EE エージェントからの転送」を選択すると 4 つの入力が表示され、そのオプションを選択しないと非表示になる正しい条件を作成します。

Html を次のように変更します。

    <td>Call Lead Type: </td>
    <td>
        <select name="CallLeadType" id="CallLeadType">
            <option value=""></option>
            <option value="LSG Service warm transfer from Claims">LSG Service warm transfer from Claims</option>
            <option value="IVR Direct Call">IVR Direct Call</option>
            <option value="Transfer from EE Agent">Transfer from EE Agent</option>
            <option value="Dropped Line">Dropped Line</option>
            <option value="Test Call from EE">Test Call from EE</option>
        </select>

<!-- add the inputs and hide them -->
        <div id="inputsTEEA" style="disply:hide">
            <input type="text"/>
            <input type="text"/>
            <input type="text"/>
            <input type="text"/>
        </div>
    </td>

JavaScript:

$(function(){
    var $inputsTEEA = $('#inputsTEEA');

    // every time that you choose a different item in the select, this event is triggered
    $('#CallLeadType').change(function(){
        var 
            $select = $(this),
            //pseudo class selected, you get the value of the currently option selected
            valSelect = $select.find('option:selected').val(); 

        if(valSelect == 'Transfer from EE Agent'){
            $inputsTEEA.show();
        }
        else{
            $inputsTEEA.hide();
        }
    });
});
于 2013-05-14T13:03:00.913 に答える
0

これを使用できます。これは、ドロップダウン リストをクリックしても、blur イベントが発生する前に発生する必要があります (単純な onchange イベントと比較して):

{oninput イベントのサポート: http://help.dottoro.com/ljhxklln.php }

var timeoutChange;
$('#CallLeadType').on('change input paste propertychange', function()
{
  clearTimeout(timeoutChange);
  timeoutChange = setTimeout(function(){
     //code your logic here
  },0);
});
于 2013-05-14T12:14:23.367 に答える