Created
February 23, 2012 22:50
-
-
Save chrisdpeters/1895543 to your computer and use it in GitHub Desktop.
Wheels + jQuery Partial for Setting Form Focus
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
<cfparam name="arguments.focus" type="string" default=""> | |
<cfif Len(arguments.focus)> | |
<cfoutput> | |
<script type="text/javascript"> | |
$(document).ready(function(){ | |
$("#arguments.focus#").focus(); | |
}); | |
</script> | |
</cfoutput> | |
</cfif> |
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
$(document).ready(function(){ | |
$("#my-form-element").focus(); | |
}); |
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
<!--- Note: This should be <cfparam>'ed earlier in the file, of course ---> | |
#includePartial(name="/layout_focus", focus=layout.focus)# |
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
<cfset layout.focus = "##my-form-element"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment