Creating HTML in jquery is a tedious and, quite frankly, boring task. Coming from a Rails web development background, I always wanted a way to create HTML like Rails does, with a content_tag method helper that can take attributes as has and be passed function blocks to quickly generate HTML within ruby. This is where the inpsiration for EasyHTMLTags comes from.
Let’s just dive in.
This plugin isnt anything complicated, just useful, so let’s see how it works.
1. Download the plugin and install into the appropriate directory.
2. Link to the plugin from your HTML
<script src="/path/to/javascripts/jquery.easy_html.js" type="text/javascript" charset="utf-8"></script>
3. Start creating tags
$.tag("li")
# => "<li></li>"
$.tag("li", "some content")
# => "<li>some content</li>"
$.tag("li", "some content", { class: "my_class", id: "special_id"})
# => "<li class="my_class" id="special_id">some content</li>"
$.tag("li", "some content", { class: "my_class", id: "special_id"}, function() { return $.tag("span", "some extra stuff")})
# => "<li class="my_class" id="special_id">some content<span>some extra stuff</span></li>"
That’s it. Hope you find it useful.
Check out the docs for more information.
—jake
Super InPlace Controls has gone through some upgrades.
We’ve Moved
First and foremost, we have moved the code from google to github.
To install run
script/plugin install git://github.com/flvorful/super_inplace_controls.git
Rails 2.3 Support
Tested with Rails 2.3 and 2.1
Better Jquery Support
We have updated the code to work better with jQuery. Now, in_place_date_selector, uses the jQuery datepicker method if available. JRails is required for jquery support.
Better Validation
Validations were a problem with SIPC, but no longer. Now, if you dont have an error div, SIPC will skip over the rendering of the error box and just add the class “fieldWithError” to the proper input tag.
Overall cleanup
Cleaned up the code in general and made it less brittle.
Check out the demos and the docs at our Open Source Site and stay tuned for some new plugins we’ve been working on.
—jake