Tuesday, 15 February 2011

jquery - Javascript plugin appending duplicate data in Wordpress -


I am using a currency conversion plugin, named after the bootstrap tab and the advanced custom fields.

Through each tab it is enclosed in the list of currencies as WP loops, so that when you open the dropdown in the third tab, you will be repeated the list of currencies three times.

Each time the code is running part of curry.js:

  var generDDM = function (rates) {output = ''; // To drop the drop down, change all the target elements drop down menu.each (function (rate in rate) {rate = rate [i]; output = = '& lt; option value = "' + i + '' Data-rate = "'+ + + rate +'" & gt; '+ i +' & lt; / option & gt; '}} $ (output) .appendTo (this);}); };  

I have tried to create a counter variable outside that block of code, after which it is run once and creates a list of currencies, It stores that list in a global output variable that is not yet attached, but has no use.

If more explanation is required, then I am happy to provide it - any help will be fantastic. 'I have spent many hours trying to understand it and I know that this would be a very simple solution needed.

Thank you!

If it is solved with simple check the length of the statement after each WP loop output variable:

  dropDownMenu.each (function () {if (output.length & lt; 251) {for rates in var i} {rate = rates [i]; output + = '& lt; Option value = "'+ + +" "data-rate ="' + + + rate + '"> gt;' + i + '& lt; / option & gt;';} $ (output) .appendTo (this) ;} And {$ (.put) .appendTo (this);}});  

No comments:

Post a Comment