Skip to content

Commit 1f0c6ca

Browse files
committed
Fix for webkit browsers bug on mac os.
Bug fix. On load a page with selected options, it was getting a wrong value. Readme updated.
1 parent 40fec49 commit 1f0c6ca

File tree

4 files changed

+25
-3
lines changed

4 files changed

+25
-3
lines changed

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,24 @@ A plugin to generate accessible custom forms: select, radio, checkbox.
2828
</script>
2929
```
3030

31-
# Options
31+
# API
32+
33+
### $.customForm(options)
34+
35+
Use this method to build the custom forms.
36+
37+
### Options
38+
39+
Options should be an object like:
40+
41+
```javascript
42+
var options = {
43+
prefix: 'my-own-prefix',
44+
keyClass: 'my-own-key-class'
45+
};
46+
47+
$.customForm(options);
48+
```
3249

3350
* **prefix:** (String)
3451
A prefix to add to all class names used on elements created by this plugin.

css/style.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,9 @@ label.lblr {
6565

6666
.custom-form-radio.custom-form-checked.custom-form-focused {
6767
background-position:-92px -39px;
68+
}
69+
70+
/* fix select height bug on webkit browsers for Mac OS */
71+
@media screen and (-webkit-min-device-pixel-ratio:0) {
72+
select.cform {-webkit-appearance: menulist-button;}
6873
}

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ <h1>jQuery Custom Forms</h1>
2121
<fieldset>
2222
<legend>Custom form</legend>
2323

24-
<p>
24+
<p class="select-wrapper">
2525
<label for="select">Select your option</label><br>
2626
<select name="data[select]" class="cform">
2727
<option value=""></option>

jquery.custom.forms-0.5.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@
173173
},
174174

175175
createFakeElement: function(element, type) {
176-
var value = (type == 'select') ? element.val() : '';
176+
var value = (type == 'select') ? $(element).children('option[value="'+element.get(0).value+'"]').html() : '';
177177
return $('<span class="'+ this.setClass(type) +'">'+ value +'</span>');
178178
},
179179

0 commit comments

Comments
 (0)