开发者

How to focus cursor on text box in php

开发者 https://www.devze.com 2023-04-06 03:23 出处:网络
How to focus cursor on text box in php. On error answer by user i want to focus the answer filed on load of page. so please suggest me...

How to focus cursor on text box in php. On error answer by user i want to focus the answer filed on load of page. so please suggest me...

if(isset($_REQUEST['sub_con_page']))
{
//correct
}
else 
{
**//开发者_JAVA技巧focus field**
}


Do this in javascript. if you use jquery then

$("input[type=text]:first").focus();


You can do that by adding javascript/jquery code inside the else part of the statement:

if(isset($_REQUEST['sub_con_page']))
{
//correct
}
else 
{ ?>
<script type="text/javascript">
$(document).ready(function() {
  $("#ID_OF_TEXT_AREA_TO_FOCUS_HERE").focus();
});
</script>
<?php } ?>

Enjoy ;)

0

精彩评论

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

关注公众号