jQuery square brackets


does anyone know how do I get the post data from html in jQuery which contains square brackets?

<input type="text" name="form[name]" />
<input type="text" name="form[email]" />
<button id="submit">

// in jQuery
$("#submit").click(function( ) {
   // how do I get the data from the form?

$("#submit").click(function( ) {

If you want the data of the form in format that can be sent to a server-side language, check jQuery documentation for serialize() method.

If they don’t want to express the full details in the selector, you can just make use of the attribute contains selector.

So if you’re sure that the page contains only one form field with email in its name:


The attribute starts with selector and [url=“http://api.jquery.com/attribute-ends-with-selector/”]attribute ends with selector can be useful tools as well.