Dinesh Santhalingam

Dinesh Santhalingam

  • NA
  • 737
  • 368.5k

How to split the object in Jquery?

Feb 13 2017 9:43 AM
I have an object .I want to append it to the Select tag using Jquery.I can able to add the first column of an object into Sucessfully.But I can't able to catch the second column
  1. var obj=[{Series1,10},    
  2.          {Series2,20},    
  3.          {Series3,30},    
  4.          {Series4,40},    
  5.          {Series5,50},    
  6.          {Series6,60},    
  7.          {Series7,70}]    
 
I want to split into separate variables. 
  1. function Load() {  
  2.            var cuisines =obj;  
  3.            var set = document.getElementById('ddllicence');  
  4.            for (var i = 0; i < cuisines.length; i++) {  
  5.            var opt = document.createElement('option');  
  6.            //Append the first row into the name  
  7.            opt.innerHTML = cuisines[i]; (Series1) 
  8.           //Append the Second row into the Value  
  9.            opt.value = cuisines[i];  (10)
  10.           set.appendChild(opt);  
  11.   
  12.            }  
 
Please help me to solve my issue.

Answers (2)