用于在WordPress中向html标签添加属性的PHP代码

可用的检查表

嗨, 我想知道在wordpress中添加” readonly”属性到输入标签和” disable”以选择标签的php代码是什么?我是wordpress的新手。\

<select name="gdlr-night" id="gdlr-night" readonly> </select>

<input disable>

#1


在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
});

#2


有一个简单的解决方案

<input type="text" name="" value="Some text" <?php echo 'readonly'; ?>> <!-- for input -->

<select class="" name="" <?php echo 'disabled'; ?>> <!-- for select -->

</select>

来源:

https://www.srcmini02.com/63758.html

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_37566.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?