javascript - Option value need to be different, Instead of being same as displayed in Select Box -


I have a problem with the javascript generated box, the problem is that I have PK-1, PK-2. In the selection box, but those values ​​will be added which will be different. For example, for PK-1, I want 1 value as is the value, similarly for PK-2, I should be in the form of value near 2. But here in this code the script PK1 is passing because it is. As I am new to java script, I do not know how to do this. Here is my code

  function categoryInput (data) {var category_vals = document.getElementById ("categroy_renew"); (Var i = 0; i & lt; data; langati; i ++) for {var option = document.createElement ("option"); Option.text = "PK -" + Data [i] .cat, data [i] .cat; Category_vals.add (option); }}    

  function categoryInput (Data) {var category_vals = document.getElementById ("categroy_renew"); (Var i = 0; i & lt; data; langati; i ++) for {var option = document.createElement ("option"); Option.text = "PK -" + Data [i] .cat; Option.value = "" + data [i] .cat; Category_vals.add (option); }}    

Comments

Popular posts from this blog

python - how we can use ajax() in views.py in django? -

matlab - Using loops to get multiple values into a cell -

python - Sequence Pattern recognition with Pybrain -