나는이 내가 지금 무엇을 가지고 드롭 다운 목록을 정렬되지 않은 목록으로 바꾸십시오. 자바 스크립트는 방법
<div id="edit-country-wrapper">
<select id="edit-country" class="form-select" name="country">
<option selected="selected" value="all">All</option>
<option value="canada">Canada</option>
<option value="usa">USA</option>
</select>
</div>
을 그리고
<div id="edit-country-wrapper">
<ul id="edit-country" class="form-select" name="country">
<li><a class="selected" href="/all">All</a></li>
<li><a class="" href="/canada">Canada</a></li>
<li><a class="" href="/usa">USA</a></li>
</ul>
</div>
로 변경하고 싶습니다.
$(document).ready(function() {
$('#edit-country-wrapper select').each(function() {
var $select = $('<div id="location-select" />');
$(this).find('option').each(function() {
var $option = $('<a />');
$option.attr({
href: '?country=' +$(this).attr('value'),
id: 'location-' + $(this).attr('value'),
class: $(this).attr('selected'),
html: $(this).html()
});
$select.append($option);
});
$(this).replaceWith($select);
});
});
정렬되지 않은 목록으로 드롭 다운 목록을 대체하려고합니다. 내가 FF & 크롬에서 일하고 있지만 IE에는 없다. 도와주세요!!
? 오류가 발생 했습니까? HTML이 잘 생성 되었습니까? – alex
IE는 드롭 다운을 목록으로 변환하지 않지만 FF 및 Chrome은 목록으로 변환합니다. – canintex