Created
February 23, 2012 17:01
-
-
Save tcaddy/1893758 to your computer and use it in GitHub Desktop.
RoR error_messages_for in jQuery Mobile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// run this after pageload/DOM ready | |
// this will modify HTML generated by Ruby on Rails :error_messages_for helper method | |
function jqmify_error_messages_for() { | |
var sel = $("div.errorExplanation"); | |
if (sel.length>0) { | |
sel.parent().addClass("ui-body").addClass("ui-body-e"); | |
sel.attr('data-role','collapsible') | |
.attr('data-theme','e') | |
.collapsible() | |
.trigger('expand'); | |
if (sel.find("ul")) { | |
sel.find("ul") | |
.attr('data-role','listview') | |
.attr('data-inset','true') | |
.attr('data-theme','e') | |
.listview(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment