用于隐藏元素的JavaScript addEventListener

时间:2015-10-22 05:40:05

标签: javascript jquery salesforce visualforce

$('.inlineData :hidden').change(function(e) { });

想要上面的javascript代码..

我正在尝试这样

var aTags = document.getElementsByClassName("inlineData");
for (var i=0;i<aTags.length;i++){
      aTags[i].addEventListener("change", function() {
          console.log('anchor');
    });
}

<td class="inlineData">
   <apex:outputField value="{!objAccount.AccountType}">
        <apex:inlineEditSupport event="ondblclick" />
   </apex:outputField>
</td>

上面的html代码生成

<td class="inlineData">
   <span id="j_id0:frmId:j_id23:j_id24:j_id33:0:j_id37:0:j_id39">
   <div class="inlineEditDiv" id="j_id0_frmId_j_id23_j_id24_j_id33_0_j_id37_0_j_id39_ileinneredit" style="display: block;">
  <span>
   <select id="j_id0_frmId_j_id23_j_id24_j_id33_0_j_id37_0_j_id39">
      <option value="">--None--</option>
      <option value="Sales Prospect">Sales Prospect</option>
      <option value="NPD Customer">NPD Customer</option>
      <option value="Partner/Cooperator Prospect">Partner/Cooperator Prospect</option>
      <option value="Partner/Cooperator">Partner/Cooperator</option>
      <option value="Press">Press</option>
      <option value="Other">Other</option>
      <option value="Inactive">Inactive</option>
      <option value="Parent">Parent</option>
    </select>
  </span>
        <a class="inlineEditUndoLink" title="Undo" href="javascript:sfdcPage.getInlineEditData('j_id0_frmId_j_id23_j_id24_j_id33_0_j_id37_0_j_id39').resetFieldById('j_id0_frmId_j_id23_j_id24_j_id33_0_j_id37_0_j_id39');" style="display: inline;">
       <img width="16px" height="16px" src="/s.gif" alt="Undo" class="inlineEditUndo"></a>
   </div>
   </span>
 </td>

这是在页面级别生成的代码。对于不同的字段,它生成不同的代码AccountType是一个选项列表,因此它生成选项列表。如果字段是文本类型字段,则代替选择列表,它将生成输入框

0 个答案:

没有答案