1

为什么选择选项表单元素在提交表单时会改变样式?

HTML:
<div ng-controller="TestController">
    <form name="test" ng-submit="formSubmit()">
        <select name="selectFormItem" ng-options="selectFormItemValue.value as selectFormItemValue.text for selectFormItemValue in selectFormItemValues" ng-required="true" ng-model="testModel" class="selectStyle">
            <option value=""></option>
        </select>
        <button id="testSubmit" type="submit">Submit</button>
    </form>
    <br/><br/>
    <span>{{selectFormItemValues}}</span>
    <br/><br/>
</div>

JS:
    function TestController($scope) {
        $scope.selectFormItemValues = [{'value':0, 'text':'value0'}, {'value':1, 'text':'value1'}];

        $scope.formSubmit = function formSubmit() {
            alert("dummySubmit!");
        }
    }

CSS:
body {
    font-family: Helvetica;
    font-size: 14px;   
}
.selectStyle {
    padding: 5px;
    width: 150px;
}

JSFiddle:http: //jsfiddle.net/nEzpS/22/

我注意到在选择表单成员上设置“必需”时会发生这种情况。

编辑:在 Chrome 版本中测试:23.0.1271.97、24.0.1312.52

4

1 回答 1

1

这似乎是某些 Chrome 版本的错误,因为该问题在其他浏览器中不存在。

于 2013-01-11T16:49:43.027 回答