亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

How to dynamically modify the placeholder of the input box through onchange in a PHP page?
語者
語者 2019-01-07 11:17:49
0
6
1081

The page has a selection box like this:


<?php echo html::select('module', $modules, '', "class=' form-control chosen' ")?>


##There is also an input box like this:


< ?php echo html::input('title', '', "class='form-control'")?>


I want to select through JS script The box triggers an onchange() function to dynamically modify the placeholder of the input box. However, I don’t know how to write the grammar. Please help me.


語者
語者

reply all(2)
我又看了一會兒,站起來轉(zhuǎn)身走了。

<!DOCTYPE html>
<html>
<head>
?? ?<title></title>
?? ?<meta charset="utf-8">
</head>
<body>
<script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
<label>請選擇:</label>
<select name="source">
?? ?<option>chargeMoney1</option>
?? ?<option>chargeMoney2</option>
?? ?<option>chargeMoney3</option>
?? ?<option>chargeMoney4</option>
</select>
<br>
<label>請查看:</label><input type="text" name="target" value="" placeholder="">

<script type="text/javascript">
?? ?$('select[name=source]').on('change',function(){
?? ??? ?// body...
?? ??? ?var source = '';
?? ??? ?source = $(this).val();
?? ??? ?$('input[name=target]').attr('placeholder',source);
?? ?})


</script>

</body>
</html>?? ?

我又看了一會兒,站起來轉(zhuǎn)身走了。

##PHP writes an interface to return the corresponding placeholder content. The front end uses ajax to call this interface and overwrite the previous placeholder with the returned content.


  • reply Thank you for your answer. But I don’t know PHP or JS at all. Can you help me write an example for reference?
    語者 author 2019-01-07 12:12:39
  • reply I simply wrote one without using PHP. This one should be more suitable for you.
  • reply Thank you very much for your example, problem solved.
    語者 author 2019-01-07 16:41:28
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template