2011-07-29 5 views
0
var attr = myopts.addAttributeFromChemSelect; 
alert(ob.attr(attr)); 

JQuery와 - 변수를 통해 ATTR을 선택

var attr = myopts.addAttributeFromChemSelect; 
alert(attr); 

는 '팁-REF'
var attr = myopts.addAttributeFromChemSelect; 
alert(ob.attr('tip-ref'); 

는 'tip_0이'입니다 정의되지

왜 첫 번째 사람이 나에게 설명 할 수 실 거예요.

관련

Consol을 로그에서

:

style="width: 100px; position: relative;" tip-ref="tip_0" name="ctl00$cphDoubleColumn$checkout$checkout_customer$ddlSalutation" class="chemSelectWrapper w_cphDoubleColumn_checkout_checkout_customer_ddlSalutation" onchange="SalutationChangeEvent_cphDoubleColumn_checkout_checkout_customer();" 
tip-ref 
undefined 
tip_0 
style="width: 170px; position: relative;" tip-ref="tip_4" name="ctl00$cphDoubleColumn$checkout$checkout_customer$ddlGender" class="chemSelectWrapper w_cphDoubleColumn_checkout_checkout_customer_ddlGender" 
tip-ref 
undefined 
tip_4 
style="width: 50px; position: relative;" tip-ref="tip_5" name="ctl00$cphDoubleColumn$checkout$checkout_customer$ddlDOBDate" class="chemSelectWrapper w_cphDoubleColumn_checkout_checkout_customer_ddlDOBDate" 
tip-ref 
undefined 
tip_5 
style="width: 100px; position: relative;" tip-ref="tip_6" name="ctl00$cphDoubleColumn$checkout$checkout_customer$ddlDOBMonth" class="chemSelectWrapper w_cphDoubleColumn_checkout_checkout_customer_ddlDOBMonth" 
tip-ref 
undefined 
tip_6 
style="width: 50px; position: relative;" tip-ref="tip_7" name="ctl00$cphDoubleColumn$checkout$checkout_customer$ddlDOBYear" class="chemSelectWrapper w_cphDoubleColumn_checkout_checkout_customer_ddlDOBYear" 
tip-ref 
undefined 
tip_7 
style="width: 170px; position: relative;" tip-ref="tip_12" name="ctl00$cphDoubleColumn$checkout$checkout_customer$ddlOccupationStatus" class="chemSelectWrapper w_cphDoubleColumn_checkout_checkout_customer_ddlOccupationStatus" 
tip-ref 
undefined 
tip_12 
style="width: 100px; position: relative;" tip-ref="tip_13" name="ctl00$cphDoubleColumn$checkout$checkout_customer$ddlYearsWithEmployer" class="chemSelectWrapper w_cphDoubleColumn_checkout_checkout_customer_ddlYearsWithEmployer" 
tip-ref 
undefined 
tip_13 
style="width: 100px; position: relative;" tip-ref="tip_14" name="ctl00$cphDoubleColumn$checkout$checkout_customer$ddlMonthsWithEmployer" class="chemSelectWrapper w_cphDoubleColumn_checkout_checkout_customer_ddlMonthsWithEmployer" 
tip-ref 
undefined 
tip_14 
style="width: 100px; position: relative;" tip-ref="tip_22" name="ctl00$cphDoubleColumn$checkout$addressUC1$ddlYearsAtAddress" onchange="javascript:__CLDVcphDoubleColumn_checkout_lightboxProcessAddresses='cphDoubleColumn_checkout_addressUC1_ddlYearsAtAddress';Page_ValidationActive=false;setTimeout('__doPostBack(\'ctl00$cphDoubleColumn$checkout$addressUC1$ddlYearsAtAddress\',\'\')', 0)" class="chemSelectWrapper w_cphDoubleColumn_checkout_addressUC1_ddlYearsAtAddress" 
tip-ref 
undefined 
tip_22 
style="width: 100px; position: relative;" tip-ref="tip_23" name="ctl00$cphDoubleColumn$checkout$addressUC1$ddlMonthsAtAddress" onchange="javascript:__CLDVcphDoubleColumn_checkout_lightboxProcessAddresses='cphDoubleColumn_checkout_addressUC1_ddlMonthsAtAddress';Page_ValidationActive=false;setTimeout('__doPostBack(\'ctl00$cphDoubleColumn$checkout$addressUC1$ddlMonthsAtAddress\',\'\')', 0)" class="chemSelectWrapper w_cphDoubleColumn_checkout_addressUC1_ddlMonthsAtAddress" 
tip-ref 
undefined 
tip_23 
style="width: 170px; position: relative;" tip-ref="tip_24" name="ctl00$cphDoubleColumn$checkout$addressUC1$ddlResidentialStatus" class="chemSelectWrapper w_cphDoubleColumn_checkout_addressUC1_ddlResidentialStatus" 
tip-ref 
undefined 
tip_24 
style="width: 100px; position: relative;" tip-ref="tip_36" name="ctl00$cphDoubleColumn$checkout$checkout_BankDetails$ddlYearsWithBank" onchange="javascript:setTimeout('__doPostBack(\'ctl00$cphDoubleColumn$checkout$checkout_BankDetails$ddlYearsWithBank\',\'\')', 0)" class="chemSelectWrapper w_cphDoubleColumn_checkout_checkout_BankDetails_ddlYearsWithBank" 
tip-ref 
undefined 
tip_36 
style="width: 100px; position: relative;" tip-ref="tip_37" name="ctl00$cphDoubleColumn$checkout$checkout_BankDetails$ddlMonthsWithBank" class="chemSelectWrapper w_cphDoubleColumn_checkout_checkout_BankDetails_ddlMonthsWithBank" 
tip-ref 
undefined 
tip_37 

코드가 플러그인에 있습니다

chemSelectboxRevert: function (opts, callbackFnk) { 

      var myopts = $.extend({ keepSelected: true, addAttributeFromChemSelect : '' }, opts); 

      var count = this.length; 

      return this.each(function (i) { 

       var ob = $(this); 

       var attr = myopts.addAttributeFromChemSelect; 

       console.log(getAttributes(ob)); console.log(attr); console.log(ob.attr(attr)); console.log(ob.attr('tip-ref')); 

       var extraAttr = ''; 

       if (myopts.addAttributeFromChemSelect != '') { 

        var attr_extra = ob.attr(myopts.addAttributeFromChemSelect); 

        extraAttr = myopts.addAttributeFromChemSelect + '="' + attr_extra + '"'; 

       } 
     .... 
     ... 
     .. 

답변

0

같은, 내 테스트를 일했다. addAttributeFromChemSelect은 무엇입니까?