Storing values of jQuery Mobile optgroup in SQLite -


I have an optgroup like this for example:

  & lt; Select id = "opt1" multiple = "multiple" data-base-menu = "wrong" data-icon = "grid" data-icon = "left" & gt; & Lt; optgroup label = "optgroup option" id = "op" & gt; & Lt; Option value = "option1" & gt; Option 1 & lt; / Options & gt; & Lt; Option value = "option 2" & gt; Option 2 & lt; / Options & gt; & Lt; / Optgroup & gt; & Lt; / Select & gt;   

This is in the jQuery mobile style and you can select many boxes. I was thinking, once you select several boxes, it comes in the form of a list that is separated by commas on the selection menu:

option1, option2 (if both options 1 and Option 2 is selected)

How do I store option 1 and option 2 as separate values ​​in my database? For example, if I have a column called "selectedoptions", then how would I like it:

Selected option

option1 - option2

Instead:

Selected option

option1, option2

in my database table

Hope this makes sense, someone It was also welcomed.

Edit: This is the code that I am using to store multicache values:

  db.transaction (function (transaction) {transaction.executeSql (enter or change in myTable (id, selected option)) \ VALUES (1,?) ', [$ (' # Myoptgroup '). Val ()], Null Handler, Erhahdler););   

This gives the values ​​I choose: option 1, option 2 in my table row, if both have been mentioned earlier have been selected.

In multiple selection elements, val () actually returns an array of values ​​already selected. You are viewing a comma-delimited list because in this way the debugger displays the ARL. You can easily run the array again like this:

  var sel = $ ("# opt1"). Val (); (Var i = 0; i & lt; sel.length; i ++) {// Create different lines here to alerts (SL [ii]); }   



Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -