var item = { ..., 'DataItem10of20' : null, ... }; $('#TextBox10of20').val(item.DataItem10of20||'');
It's always a good idea to either use a ||'' or cast your data to a string or other proper datatype when using jQuery, a large number of the methods will have somewhat undesirable results if you try using null or undefined, it's a known issue. ~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name] vdhant wrote: > Not really, because I have simplified my case a little and it actually > looks a little more like this: > > > .... > <input type="text" id="TextBox10of20" /> > ..... > > <script> > var item = { ..., 'DataItem10of20' : null, ... }; > $('#TextBox10of20').val(item.DataItem10of20); > </script> > > Cheers > Anthony > > On Jun 17, 10:20 am, samer <samerzia...@gmail.com> wrote: > >> You can try passing an empty string $('#Test').val(''); >> I don't know whyt it's behaving that way though >> >> On Jun 16, 8:01 pm, vdhant <vdh....@gmail.com> wrote: >> >> >>> Hi guys >>> I have the following case: >>> >>> <input type="text" id="Test" /> >>> <script> >>> $('#Test').val(null); >>> </script> >>> >>> See working example here:http://jquery.nodnod.net/cases/421 >>> >>> In IE (i have tested in IE7), it puts the words null into the textbox >>> in all other browsers it puts nothing into the textbox. Why is this??? >>> >>> Cheers >>> Anthony >>> > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---