easyui validatebox动态设置或取消readonly

使用easyui做了一个表单,其中包括validatebox框,现在需要根据后台的值动态设置其是否可写(readonly)

例如:

<input type=”text” id=”formpinyin” class=”easyui-validatebox e-input”
name=”model.pinyin” style=”width:180px” required=”true”></input>

javascript:

$(function(){
$(‘#myform’).form({
‘onLoadSuccess’:function(data){
if($(‘#formmailexist’).val() == true || $(‘#formmailexist’).val() == ‘true’){
$(‘#formpinyin’).attr(‘readonly’,true);
}else{
$(‘#formpinyin’).attr(‘readonly’,false);
}
}
});
});

This entry was posted in Computer, javascript. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s