That won't work. Try this test: alert( "" + null ); // "null" - but we wanted ""
This would work: $('#verMailDate').attr( "value",data.verMailDate == null ? "" : data.verMailDate ); Or if it's OK to treat 0 the same as null, this simpler code would work: $('#verMailDate').attr( "value",data.verMailDate || "" ); -Mike On Thu, Sep 10, 2009 at 9:32 AM, MorningZ <morni...@gmail.com> wrote: > > Easy fix > > $('#verMailDate').attr("value",data.verMailDate); > > to > > $('#verMailDate').attr("value","" + data.verMailDate); > > > > On Sep 10, 12:17 pm, Junhua Gao <gaojun...@gmail.com> wrote: > > $.getJSON('/VersionQueryJsonAction',{verID:verid},function(data){ > > $('#verMailDate').attr("value",data.verMailDate); > > $('#statementName').attr("value",data.statementName); > > > > })//CampaignJsonAction,function,getJSON > > > > if data.verMailDate is null,i need it is "",not "null",who can help me? >