获取元素name
获取元素name
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<script src="https://cdn.bootcss.com/jquery/3.5.0/jquery.js"></script>
<body>
<div class="form-group ">
<label for="11" class="col-sm-2 control-label">抬头纹</label>
<div class="col-sm-8">
<select class="form-control phone_type_1_11 select2-hidden-accessible" style="width: 100%;" name="phone_type_1[11][]" multiple="" data-placeholder="输入 抬头纹" data-value="6,10" tabindex="-1" aria-hidden="true">
<option value="5">氧化</option>
<option value="6" selected="">毛孔堵塞</option>
<option value="7">清洁残留</option>
<option value="8">油脂分泌</option>
<option value="9">挤压粉刺</option>
<option value="10" selected="">刺激性化妆品</option>
<option value="11">日晒</option>
<option value="12">缺水</option>
<option value="13">面部表情</option>
<option value="14">衰老</option>
<option value="15">油脂旺盛</option>
<option value="16">不良饮食</option>
<option value="17">激素紊乱</option>
<option value="18">含氟牙膏</option>
<option value="19">辐射</option>
<option value="20">代谢不良</option>
<option value="21">遗传</option>
<option value="22">熬夜</option>
<option value="23">内分泌失调</option>
<option value="24">饮食习惯</option>
</select><span class="select2 select2-container select2-container--default select2-container--below select2-container--focus select2-container--open" dir="ltr" style="width: 100%;"><span class="selection"><span class="select2-selection select2-selection--multiple" role="combobox" aria-haspopup="true" aria-expanded="true" tabindex="-1" aria-owns="select2-phone_type_111-xg-results" aria-activedescendant="select2-phone_type_111-xg-result-ftju-10"><ul class="select2-selection__rendered"><span class="select2-selection__clear">×</span><li class="select2-selection__choice" title="毛孔堵塞"><span class="select2-selection__choice__remove" role="presentation">×</span>毛孔堵塞</li><li class="select2-selection__choice" title="清洁残留"><span class="select2-selection__choice__remove" role="presentation">×</span>清洁残留</li><li class="select2-selection__choice" title="油脂分泌"><span class="select2-selection__choice__remove" role="presentation">×</span>油脂分泌</li><li class="select2-selection__choice" title="刺激性化妆品"><span class="select2-selection__choice__remove" role="presentation">×</span>刺激性化妆品</li><li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="0" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" aria-autocomplete="list" placeholder="" style="width: 0.75em;"></li></ul></span></span><span class="dropdown-wrapper" aria-hidden="true"></span></span><div class="text-right"><a class="btn btn-sm btn-info resetDefault"><i class="fa fa-repeat"></i> 恢复默认</a></div>
<input type="hidden" name="phone_type_1[11][]">
</div>
</div>
<script>
var dd = $(".resetDefault").closest("div").prev().prev().attr('name');
alert(dd);
</script>
</body>
</html>