set value button to a text box then move to the next one jquery -
i have 2 buttons , 2 text fields.
i want click on button value button , set value of text field , move other text.
i have made value fill don't know how move next textbox here code can make button value on first textbox , not on second 1
<script> $(document).ready(function(){ $('button').click(function() { var btnv = this.value; $('#test1').val(this.value); }); }); </script> </head> <body> <div data-role="page" id="page"> <div data-role="content"> <div> <input type="text" id="test1" value="" disabled > <input type="text" id="test2" value="" disabled> <button id="btn1" value="v">bn1</button> <button id="btn2" value="r" >bn2</button> </div> </div> </body>
if using jquery, in click event handler button add following code.
$(this).next("input[type=text]").focus();
Comments
Post a Comment