开发者

jquery replace title with input value

How can I replace all input titles value in a form with input or textarea values using Jquery and 'each' ?

<form id="id001" action="" method="post">
    <fieldset id="F001">
    <legend>F001 : Consulter mes informations professionnelles</legend>
    <div id="msg"></div>
    <label for="EMPLOYEE_NUMBER">
        Matricule de l'agent:
    </label>
    <input name="EMPLOYEE_NUMBER" type="text" id="EMPLOYEE_NUMBER" value="ID999" readonly="readonly" />
    <br /> 
    <label for="LAST_NAME">
        Nom:
    </label>
    <input type="text" name="LAST_NAME" id="LAST_NAME" value="Test" title="" />
    <br /> 
    <label for="FIRST_NAME">
        Prénom:
    </label>
    <input type="text" name="FIRST_NAME" id="FIRST_NAME" value="Jack" title="" />
    <br /> 
    <br开发者_StackOverflow社区 class="clear" />
    <label>
        &nbsp;
    </label>
        <input type="submit" value="Envoyer" />
        <input name="WF" type="hidden" id="WF" value="WF2" />
    </fieldset>
</form>

Thanks for your help...

Chris


Try this

$("input, textarea").each(function(){
    $(this).attr("title", this.value);
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜