diff options
author | Struan Donald <struan@exo.org.uk> | 2011-11-24 17:39:00 +0000 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2011-11-24 17:39:00 +0000 |
commit | 6bac380784eebb21ea8e6d251501281704203996 (patch) | |
tree | 351fe9a5e703d098f4fdb2297f8d6f6243fdb26d /web/js | |
parent | edcbfb56ec4202f9c64e93905ed5a6da305ad028 (diff) |
change the way we display validation errors to get round ios 5 bug
Diffstat (limited to 'web/js')
-rw-r--r-- | web/js/fixmystreet.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/web/js/fixmystreet.js b/web/js/fixmystreet.js index 3d248a5dc..33d2a0a0f 100644 --- a/web/js/fixmystreet.js +++ b/web/js/fixmystreet.js @@ -73,7 +73,15 @@ $(function(){ // we do this to stop things jumping around on blur success: function (err) { if ( form_submitted ) { err.addClass('label-valid').html( ' ' ); } else { err.addClass('label-valid-hidden'); } }, errorPlacement: function( error, element ) { - element.parent('div').before( error ); + /* And all because the .before thing doesn't seem to work in + mobile safari on iOS 5. However outerHTML is not cross + browser so we have to have two solutions :( */ + if ( element[0].outerHTML ) { + var html = element.parent('div').html(); + element.parent('div').html( error[0].outerHTML + html ); + } else { + element.parent('div').before( error ); + } }, submitHandler: function(form) { if (form.submit_problem) { |