多个onblur元素会出错

时间:2017-11-15 14:36:59

标签: javascript jquery

我尝试在表格中调用我的三个元素的函数onblur

但我在我的控制台中收到此错误

" ((m.event.special [e.origType] ||(中间值))。handle || e.handler).apply不是函数&#34 ;

所以onblur这些元素我想调用我的函数。请看一下我的代码。

在这里为我糟糕的笔迹道歉。我是javascript的新手

jq.ajax({
        url: '/soap/ajax/36.0/connection.js',
        dataType: 'script',
        success: function() {
            jq(document).ready(function() {
                // call tookit dependent logic here
                jq('#gbMainTable').on('blur', 'tr.dr td[name="v4"] select','tr.dr td[name="v6"] select','tr.dr td[name="v7"] input', function() 
                { 
                    var thisInput = this;
                    console.log('thisInput.value',thisInput.value);
                    var thisInput1 = jq(this);

                    var thisRow = thisInput1.parents('tr.dr:first');
                    console.log('thisRow',thisRow);

                    var agentInput1 = thisRow.find('td:eq(7)');
                    console.log('agentInput1',agentInput1);
                    var finds1 = agentInput1.find('select');
                    console.log('finds1',finds1);
                    var agentInput2 = thisRow.find('td:eq(8)');
                    console.log('agentInput2',agentInput2);
                    var finds2= agentInput2.find('input');

                    if(agentInput1.text()!=='' & thisInput.value=='Programmable Cntrls/Welders/AC Drives/Soft Starts'){
                        exampleFunction('Programmable',agentInput1.text(),agentInput2.text());
                        console.log('YES');
                    }
                    else if(agentInput1.text()!=='' & thisInput.value=='Electro Mechanical'){
                        exampleFunction('Electro-Mechanical',agentInput1.text(),agentInput2.text());
                    }
                });

            });
        },
        async: false
    });

    function exampleFunction(Warranty,Years,charge) {
        var state = { // state that you need when the callback is called
              output : null,
              startTime : new Date().getTime()};

          var callback = {
              //call layoutResult if the request is successful
              onSuccess: doThis,

              //call queryFailed if the api request fails
              onFailure: queryFailed,
              source: state};

         sforce.connection.query(
             "SELECT InOut__c,PlantPct__c,T37Pct__c,TotalPct__c,Type__c,Warranty_Code__c,Years__c FROM WarrantySpecialLine__c where InOut__c = '" +charge+"' and Years__c = '"+Years+"' and Type__c = '" +Warranty +"'",
              callback);
    }

    function queryFailed(error, source) {
        console.log('error: '+error);
    }

    /**
      * This method will be called when the toolkit receives a successful
      * response from the server.
      * @queryResult - result that server returned
      * @source - state passed into the query method call.
      */
    function doThis(queryResult, source) {
        if (queryResult.size > 0) {
            var output = "";

            // get the records array
            var records = queryResult.getArray('records');

            // loop through the records
            for (var i = 0; i < records.length; i++) {
                var warrantySpecial = records[i];

                console.log(warrantySpecial.PlantPct__c + " " + warrantySpecial.TotalPct__c + " " +warrantySpecial.T37Pct__c );
            }
        }
    }

0 个答案:

没有答案