Skip to content

Instantly share code, notes, and snippets.

Created Sep 8, 2014
What would you like to do?
<!DOCTYPE html>
<html lang="ja">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- この学校部活のid3桁で管理してるっぽいけど999個以上の部活動できたらどうするのかなとか考えちゃうよね -->
<select id="clubSelector">
<option value="cl001">サッカー部</option>
<option value="cl002">野球部</option>
<option value="cl003">吹奏楽部</option>
<ul id="memberlist"></ul>
新しいウィンドウの名前: <input id='newWindowName' type="text"> <br>
<a href="#" id="openWindow">開く</a>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src=""></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
var clubMembers = {
'cl001': ['st13010', 'st13011', 'st14012'],
'cl002': ['st13100', 'st14100', 'st14005'],
'cl003': ['st12023', 'st13045', 'st14009']
var students = {
'st13010': {'name': 'A', 'grade': 2, 'class': 'A', 'sex': 'F'},
'st13011': {'name': 'B', 'grade': 2, 'class': 'A', 'sex': 'M'},
// 'st14012': {'name': 'C', 'grade': 1, 'class': 'A', 'sex': 'M'},
'st13100': {'name': 'D', 'grade': 2, 'class': 'A', 'sex': 'M'},
'st14100': {'name': 'E', 'grade': 1, 'class': 'A', 'sex': 'F'},
'st14005': {'name': 'F', 'grade': 1, 'class': 'A', 'sex': 'M'},
'st12023': {'name': 'G', 'grade': 3, 'class': 'A', 'sex': 'F'},
'st13045': {'name': 'H', 'grade': 2, 'class': 'A', 'sex': 'M'},
'st14009': {'name': 'I', 'grade': 1, 'class': 'A', 'sex': 'F'}
var clubMembersDetail = function(clubName){
var detail = [];
$.each(clubMembers[clubName], function(){
return detail;
$('#clubSelector').on('change', function () {
var clubName = this.value
$.each(clubMembersDetail(clubName), function(){
$('ul#memberlist').append('<li>' + + '</li>')
$('#openWindow').on('click', function(){'./', $('#newWindowName').val());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment