DatePicker将文本放在按钮上而不是图像上 [英] DatePicker puts text on button instead of image
问题描述
让我告诉你我正在经历的事情。
之前, / p>
After。
以下是我用于DatePicker的代码
$(。datepicker1)。datepicker({
showOn:'both',
buttonImage:'<%= Url.Content(〜/ images /calendar.gif\")%>',
dateFormat:'mm / dd / yy',
changeMonth:true,
changeYear:true
});
发生在我身上的一件事是,我的jquery验证器可能会覆盖一些东西...
这里是我的jquery代码...
$(#temp1)。validate({
rules: {
HospitalFinNumber:{
required:true,
minlength:6
},
DateOfBirth:{
required:true
},
AdmitDate:{
required:true
}
},
消息:{
HospitalFinNumber:'请输入医院Fin编号',
DateOfBirth:'请输入一个有效的DateOfBirth',
AdmitDate:'请选择一个管理日期'
},
errorElement:div,
wrapper:div,
errorPlaceMent:function(error,element){
element.before(error);
offset = element.offset() ;
error.insertBefore(element);
error.css('position','absolute');
error.css('left',offset.left);
error.css('top',offset.top - element.outerHeight());
}
});
我猜这也与按钮宽度变宽有关。我怎样才能确保按钮的宽度始终保持不变?这可能会解决问题。另外,如果您没有答案,请建议我可以去哪里了解更多有关该问题的信息,以及可能的解决方法。任何帮助都是朝着正确方向迈出的一步。此外,我希望这篇帖子不会让我超过30天! :-)。
另外,如何设置error.css的宽度,以便在弹出错误消息时不会发生变化?
更新与我的验证方式有关
我认为这与我如何放置错误元素在我的桌子上。
如何将我的错误消息正确放置在表列中Row?
buttonImageOnly:true
完成了!
jquery UI date picker puts a text on top of a button instead of the image which I attempt to link to in the Jquery. This occurs on submit and when IE 8 is in compatibility mode. Has anybody ever come across this? This is the weirdest thing I have ever seen. Anybody have any idea why this is going on?
Let me show you a picture of what I am experiencing.
Before,
After.
Here is the code that i use for the DatePicker
$(".datepicker1").datepicker({
showOn: 'both',
buttonImage: '<%=Url.Content("~/images/calendar.gif")%>',
dateFormat: 'mm/dd/yy',
changeMonth: true,
changeYear: true
});
One thing that occurred to me is that my jquery validator might be overwriting something... Here is my jquery code...
$("#temp1").validate({
rules: {
HospitalFinNumber: {
required: true,
minlength: 6
},
DateOfBirth: {
required: true
},
AdmitDate: {
required: true
}
},
messages: {
HospitalFinNumber: 'Please Enter a Hospital Fin number',
DateOfBirth: 'Please enter a valid DateOfBirth',
AdmitDate: 'Please select an Admin Date'
},
errorElement: "div",
wrapper: "div",
errorPlaceMent: function (error, element) {
element.before(error);
offset = element.offset();
error.insertBefore(element);
error.css('position', 'absolute');
error.css('left', offset.left);
error.css('top', offset.top - element.outerHeight());
}
});
I guess it also has something to do with the button width getting wider. How can I ensure that the button width always stays the same? That might solve the problem. Also, if you don't have an answer, please suggest where I can go to learn more about the problem, and possible way's to fix it. Any help at all would be a step in the right direction. ALso, I hope that this particular post doesn't put me over my 30 day total! :-). Also, How can I set the width of the error.css so that it doesn't go nuts when the error message pops up?
UPDATE Has to do with how I validate I guess
I am thinking this has to do with how I place my error element in my table. How can I place my error message correctly inside a table column,Row?
set buttonImageOnly to true...
buttonImageOnly: true
That did it!
这篇关于DatePicker将文本放在按钮上而不是图像上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!