136
|
1 |
$(document).ready( |
|
2 |
function() { |
|
3 |
$('.my-skinnable-select').each( |
|
4 |
function(i) { |
|
5 |
selectContainer = $(this); |
|
6 |
// Remove the class for non JS browsers |
|
7 |
selectContainer.removeClass('my-skinnable-select'); |
|
8 |
// Add the class for JS Browers |
|
9 |
selectContainer.addClass('skinned-select'); |
|
10 |
// Find the select box |
|
11 |
selectContainer.children().before('<div class="select-text">a</div>').each( |
|
12 |
function() { |
|
13 |
$(this).prev().text(this.options[0].innerHTML) |
|
14 |
} |
|
15 |
); |
|
16 |
// Store the parent object |
|
17 |
var parentTextObj = selectContainer.children().prev(); |
|
18 |
// As we click on the options |
|
19 |
selectContainer.children().click(function() { |
|
20 |
// Set the value of the html |
|
21 |
parentTextObj.text(this.options[this.selectedIndex].innerHTML); |
|
22 |
}) |
|
23 |
} |
|
24 |
); |
|
25 |
} |
|
26 |
); |