jquery - How can i give numbering for option values -


the below code want give number every value <option value="1" />vijay

but apple+ should there because want assign values using jquery thats want add + value can modify <option value="1" />vijay

but due template design want give <option value="1" value=vijay+/>vijay dont think correct correct format.

<select id="cmbcolumn">     <option value="" />columns     <option value="apple+" />apple     <option value="berry+" />berry </select>  <select id="cmbsidebar" name="cmbsidebar">     <option value="" />sidebars     <option value="grapes+" />grapes     <option value="mango+" />mango                </select> 

my main aim achieve example values apple+ , apple , giving number values.

this other code want give numbering values like above said need grapes+ values them

<select id="cmbsidebar">     <option value="1" />vijay     <option value="2"/>1004045  </select>  <select id="combo-014">     <option value="1" />1003045     <option value="2" />1004045  </select> 

you can use data attributes value attribute this:

document.getelementbyid("options").onchange = function(e) {    // selected option element    var target = e.explicitoriginaltarget;        // value    console.info(target.getattribute("value"));        // data-value    console.info(target.getattribute("data-value"));  }
<select id="options">    <option value="">sidebars</option>    <option value="1" data-value="grapes+">grapes</option>    <option value="2" data-value="mango+">mango</option>  </select>


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -