如果满足参数、jQuery、PHP、会话,则更改按钮值
我有以下按钮:如果满足参数、jQuery、PHP、会话,则更改按钮值,php,jquery,session,Php,Jquery,Session,我有以下按钮: <input type="button" count='<?php echo count($_SESSION['children']);?>' name="children" class="add_child" value="Add Another Child"/> 使用您已有的代码尝试此操作: $('.add_child').click(function(){ //code... $(this).val('Add Another Child
<input type="button" count='<?php echo count($_SESSION['children']);?>' name="children" class="add_child" value="Add Another Child"/>
使用您已有的代码尝试此操作:
$('.add_child').click(function(){
//code...
$(this).val('Add Another Child');
})
以及输入的php:
<input type="button" count='<?php echo count($_SESSION['children']);?>'
name="children" class="add_child"
value="<?php echo (isset($_SESSION['children'])?
'Add Another Child':'Add a Child');?>"
/>
该如何检查输入子项是否存在?不存在。当它被点击的时候,它会改变为添加另一个孩子,这个按钮应该已经添加了一个孩子。我为输入孩子添加了php,我只是用昨天的一句话尝试了一下,谢谢!对不起,我离开了机器
<input type="button" count='<?php echo count($_SESSION['children']);?>'
name="children" class="add_child"
value="<?php echo (isset($_SESSION['children'])?
'Add Another Child':'Add a Child');?>"
/>