This is getting a bit crazy, i have two divs in my page and two slect lists in each div.
in first div the code is working as expected but in second div it's not.i have written fallowing code in both div- <select onchange="populateStateSelectBox('','ADDR_SHIP_COUNTRY','ADDR_SHIP_STATE');" name="ADDR_SHIP_COUNTRY" id="ADDR_SHIP_COUNTRY" data-native-menu="false" data-theme="c">
<option value="">Country</option>
<option value="zx">'''' </option>
<option value="af">Afghanistan </option>
<option value="hh">Aftab </option>
<option value="ar">Aire </option>
</select>
AS i read this line in jquery docs-To use custom menus on a specific select, just add the data-native-menu="false" attribute
Here is reference Jquery Select List i did the same, but it's working in first div but doesn't working in second div.. Any one having any idea why it's happening like that, i am trying to resolve since last 5 hrs, but no luck.. :( Please some one suggest me where i am wrong.I want this out put...http://jsfiddle.net/XbbdU/3/
EDTIT- Code related to second list-
<b>Country *:</b>
<select data-theme="c" data-native-menu="false" id="<%=WebKeys.ADDR_SHIP_COUNTRY%>" name="<%=WebKeys.ADDR_SHIP_COUNTRY%>" onchange="populateStateSelectBox('','<%=WebKeys.ADDR_SHIP_COUNTRY%>','<%=WebKeys.ADDR_SHIP_STATE%>');" >
<option value ="">Country</option>
<%for(int i=0; i<countryBean.length ;i++){
CountryBean country = countryBean[i];%>
<option value ="<%=country.getCountryCode()%>" <%if(country.getCountryCode().equals(shippingAddress.getCountry())){%> selected <%}%> ><%= country.getCountry()%> </opti开发者_如何学Pythonon>
<%}%>
</select>
On Click of this list i am populating the content of second list..as you can see i have called a function on onchange event..
Try triggering a create in the second div-probably as the last line in your populateStateSelectBox
method.
Something like this:
$("#div2").trigger('create');//div2 is the id of the div enclosing second select
You can't have two selects with the same ID on a page. Give each one a unique ID. I have assumed this answer because you say "it doesn't work in the second div"... if you want further help, please post some more mark up (eg the select in the second div).
精彩评论