[英]PHP code for add attributes to html tag in wordpress
在PHP中使用
<input type="text" <?php echo "readonly";?> />
但是,我认为您需要使用javascript来做到这一点? 按下按钮时设置为只读?
jQuery代码:
$('.button1').click(function(){
$(this).prop('disabled',true);//recommend
//$(this).attr('disabled','disabled'); not recommend
//ajax checking
});
有一个简单的解决方案
<input type="text" name="" value="Some text" <?php echo 'readonly'; ?>> <!-- for input -->
<select class="" name="" <?php echo 'disabled'; ?>> <!-- for select -->
</select>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.