Note that there are some explanatory texts on larger screens.

plurals
  1. POselect an option using javascript on success of request
    primarykey
    data
    text
    <p>select day , month and year by jsondata</p> <pre><code>success: function(jsondata){ var data=JSON.parse(jsondata); var list_html="&lt;div id='editrelation'&gt;&lt;label id='dateLabel' style='display:none'&gt;Since/Anniversary&lt;/label&gt;&lt;select style='display:none' id='month' class='' aria-label='Month' name='month'&gt;&lt;option value='-1'&gt;Month:&lt;/option&gt;&lt;option value='1'&gt;Jan&lt;/option&gt;&lt;option value='2'&gt;Feb&lt;/option&gt;&lt;option value='3'&gt;Mar&lt;/option&gt;&lt;option value='4'&gt;Apr&lt;/option&gt;&lt;option value='5'&gt;May&lt;/option&gt;&lt;option value='6'&gt;Jun&lt;/option&gt;&lt;option value='7'&gt;Jul&lt;/option&gt;&lt;option value='8'&gt;Aug&lt;/option&gt;&lt;option value='9'&gt;Sep&lt;/option&gt;&lt;option value='10'&gt;Oct&lt;/option&gt;&lt;option value='11'&gt;Nov&lt;/option&gt;&lt;option value='12'&gt;Dec&lt;/option&gt;&lt;/select&gt;&lt;select id='day' class='' aria-label='Day' name='day' style='display:none; margin-left: 74px; margin-top: -25px;'&gt;&lt;option value='-1'&gt;Day:&lt;/option&gt;"; for(var i=1;i&lt;=31;i++){ list_html+="&lt;option value="+i+" id='d"+i+"'&gt;"+i+"&lt;/option&gt;"; } list_html+="&lt;/select&gt;&lt;select style='display:none; margin-top: -25px; margin-left: 130px;' id='year' class='' aria-label='Year' name='year'&gt;&lt;option value='-1'&gt;Year:&lt;/option&gt;"; for(var i=2014;i&gt;=1914;i--){ list_html+="&lt;option value="+i+" id="+i+"&gt;"+i+"&lt;/option&gt;"; } list_html+="&lt;/select&gt;" list_html+="&lt;/div&gt;"; document.getElementById('form_relation').innerHTML=list_html; if(data['date']!=undefined){//data['date']='1/24/1990' var ani=data['date']; var dateArray=ani.split("/"); var month=dateArray[0]; var day=dateArray[1]; var year=dateArray[2]; document.getElementById("month").selectedIndex =month; document.getElementById("day").selectedIndex =day; document.getElementById("year").selectedIndex =year; } } </code></pre> <p>below line is not working</p> <pre><code>document.getElementById("year").selectedIndex =year; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload