form2js icon indicating copy to clipboard operation
form2js copied to clipboard

feature request: jquery!

Open lookfirst opened this issue 13 years ago • 4 comments

I'd love to be able to use a jquery selector as a rootNode.

lookfirst avatar Nov 13 '11 03:11 lookfirst

Check out jquery.toObject.js & jquery.example.html

maxatwork avatar Nov 13 '11 09:11 maxatwork

ok... just used .get(0) and that was enough for me. still though, i'd love to see your whole plugin re-done as a jquery function... it'd be easier to deal with...

lookfirst avatar Nov 14 '11 19:11 lookfirst

Man, I'm saying there's jquery plugin already.

<script src="jquery.min.js"></script>
<script src="form2js.js"></script>
<script src="jquery.toObject.js"></script>
<script>
    // no .get(0)
    var formData = $('any selector').toObject();
</script>

maxatwork avatar Nov 15 '11 10:11 maxatwork

Yea, but I don't need to include your whole plugin when .get(0) works well enough with a few lines of coffeescript...

        # small wrapper to work with jquery
        form2js: (node) ->
            form2js(node.get(0), '.', false)
        js2form: (node, obj) ->
            js2form(node.get(0), obj)

lookfirst avatar Nov 15 '11 16:11 lookfirst