HTML5 placeholder value模拟法表单序列化的局限实例页面(原文)

代码:

HTML代码:
<form id="form">
    <p>
        <span class="title">姓名:</span>
        <input type="text" id="name" name="name" placeholder="2-10个字符" />
    </p>
    <p>
        <span class="title">手机号:</span>
        <input type="text" id="tel" name="tel" placeholder="保密的" />
    </p>
    <p>
        <span class="title">电子邮箱:</span>
        <input type="email" id="email" name="email" placeholder="用于找回密码" />
    </p>
    <p>
        <span class="title">&nbsp;</span>
        <input type="button" id="button" value="点击我序列化表单" />
    </p>
</form>
                
JS代码:
var funPlaceholder = function(element) {
    //...
};

funPlaceholder(document.getElementById("name"));
funPlaceholder(document.getElementById("tel"));
funPlaceholder(document.getElementById("email"));

//表单序列化 - jQuery
$("#button").bind("click", function() {
    alert($("#form").serialize());	
});
                

效果:

姓名:

手机号:

电子邮箱: