Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/229.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在此代码中聚焦textarea_Php_Html - Fatal编程技术网

Php 如何在此代码中聚焦textarea

Php 如何在此代码中聚焦textarea,php,html,Php,Html,fetch\u customer\u info.php <button id=printToTextarea>Get to box</button> Get to box text.php <?php require_once('fetch_customer_info.php'); ?> <script type="text/javascript"> $("#printToTextarea").on("click", function () {

fetch\u customer\u info.php

<button id=printToTextarea>Get to box</button>
Get to box
text.php

<?php
require_once('fetch_customer_info.php');
?>
<script type="text/javascript">
$("#printToTextarea").on("click", function () {alert(3);
    $(this).next("#textInput").focus();
 });
 </script>

<div id="projectNameDiv">
    <label for="textInput">Text to Print:</label><br/>
    <textarea name="textInput" id="textInput"  rows='3' cols='40'></textarea>
</div>

$(“#printToTextarea”)。在(“单击”,函数(){alert(3);
$(this).next(#textInput”).focus();
});
要打印的文本:
当我单击“进入框”按钮时,不会出现警告消息。我需要聚焦文本区域。

删除
$(此).next()
函数

$(“#printToTextarea”)。在(“单击”,函数(){
警惕(3);
$(“#text1”).focus();
});

进入框
删除
$(this).next()
函数

$(“#printToTextarea”)。在(“单击”,函数(){
警惕(3);
$(“#text1”).focus();
});


进入框
显示HTML的其余部分。另外,当您试图查找
id
时,无需使用
next()
,只需执行
$(“#textInput”)。focus()
@powerboulg不起作用。我不喜欢在一个文件中同时使用这两个部分。显示HTML的其余部分。另外,当您试图查找
id
时,无需使用
next()
,只需执行
$(“#textInput”)。focus()
@powerboulg不起作用。我不喜欢在一个文件中同时使用这两个部分。