Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var els = new Array();
- var pleaseselect;
- $j("select.wpsc_select_variation option").each(function(index, ele){
- if(index == 0){
- pleaseselect = ele;
- return;
- }
- var i = $j(ele).text();
- i = i.replace("\"", "");
- i = i.replace("''", "");
- if (i.indexOf("-") >= 0){
- i = i.split('-');
- split = i[1].split('/');
- i = eval(i[0]) + split[0] / split[1];
- }
- else if(i.indexOf("/") >= 0){
- split = i.split('/');
- i = split[0] / split[1];
- }
- i = eval(i);
- els[i] = ele;
- //note 1
- console.log(i + ':' + ele);
- });
- //note 2
- $j.each(els, function(index, el){
- console.log(index + ':' + el);
- });
- //note 3
- $j(els).each(function(index, ele){
- console.log(index + ':' ele);
- });
- In Chrome, the console.log at note 1 results in:
- [1: option, 2: option, 0.75: option, 0.375: option,
- 0.625: option, 1.5: option, 1.25: option, 1.75: option, 0.5: option]
- >
- >0.5: option
- >0.75: option
- >0.375: option
- >0.625: option
- >1: option
- >1.5: option
- >1.25: option
- >1.75: option
- >2: option
- length: 3
- >__proto__: Array[0]
- Where the > is a expand/collapse-able arrow that expands/collapses what is below it. Clicking and of the sub >'s expands that full object - with all of the properties you would expect from an option object.
- However, the length of the array appears to be 3.
- In Firefox, the log shows this (same behavior as chrome, but with + instead of >)
- The two options in the parent correspond with the option at value 1 and 2.
- +[undefined, option, option]
- +0.375 option
- +0.5 option
- +0.625 option
- +0.75 option
- +1 option
- 1.25 option
- 1.5 option
- 1.75 option
- 2 option
- Note 1 and note 2 result (respectively) in this:
- 0:undefined
- 1:<option value="13">1"</option>
- 2:<option value="21">2''</option>
- and this:
- 0:undefined
- 1:[object HTMLOptionElement]
- 2:[object HTMLOptionElement]
Advertisement
Add Comment
Please, Sign In to add comment