well, just note it for memo.
html:
less:
html:
less:
/* Select arrow styling */
.address_city_chooser{
>div{
position:relative;
display:inline-block;
&.disabled{
label:after{
content: '';
width: 23px;
height: 23px;
position: absolute;
display: inline-block;
top: 4px;
right: 4px;
background: #fff;
pointer-events: none;
}
}
}
}
and js:
$.get(
Routing.generate('prospection_public_city',{'postCode':code,'_locale':currentLang}),
function(response){
if(typeof response.error!="undefined"){
$('#errorDialog').html(response.error);
$('#errorDialog').dialog('open');
}else{
$(container).html(response);
if ($(container).find('option').length<2){
$(container).prop('disabled', 'disabled');
$(container).closest('div').addClass('disabled');
}else{
$(container).prop('disabled', false);
$(container).closest('div').removeClass('disabled');
}
//what ever we set the first in select.
var postcodeRadio=$(container).closest('.address_city_chooser').find('.address_city input');
//set the submit value
$(postcodeRadio).val($('option:selected', container).val());
}
});
评论
发表评论