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

を経由して選択attrが未定義jqueryの - 変数

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

である '先端-refの'

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

である理由最初の 'tip_0'

は、誰も私に説明できています仕事はありません。コンソルログから

よろしく

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とは何ですか?