[jQuery] Updating select content

2008-03-31 Thread Minh

I'm trying to improve the speed of my script which is currently using
html() to replace content of a select element.  The
updateSelectOptions() method take an array and create a string of
options to replace the select element.

function updateSelectOptions(aOptions, fieldID) {
if($(select#+fieldID).length){
sOptions = '';
for (var i = 0; i  aOptions.length; i++) {
sOptions += 'option value=' + aOptions[i].oV + ''
+ aOptions[i].oT + '/option';
}
$(select#+fieldID).html(sOptions);
}
}

I've tried using replaceWith() instead of html() and that improve the
script executing from 7sec to about 1.2sec.  The only problem with
replaceWith() is that I lose the on change event that's bind to the
select element.  I've tried unbinding the before the replaceWith() and
rebinding change event after replaceWith() but the script end up
freezing when the change event is triggered for the second time.

Does anyone have a suggestion?


[jQuery] Re: Sticky Footer

2007-10-31 Thread Minh

Some layout examples with footer always at the bottom.

http://www.pmob.co.uk/temp/3colfixedtest_4.htm



[jQuery] Re: Unselect text

2007-09-14 Thread Minh

One thing I've noticed is that this is only happening in IE 6 and not
FireFox.

On Sep 13, 11:00 am, Minh [EMAIL PROTECTED] wrote:
 I have the following script to auto select the text in a input field
 on focus.
 $([EMAIL PROTECTED]'text']).focus(function(){
 if($(this).val().length  0){
 this.select();
 }

 });

 On blur is there a way in can unselect the selected text?



[jQuery] Unselect text

2007-09-13 Thread Minh

I have the following script to auto select the text in a input field
on focus.
$([EMAIL PROTECTED]'text']).focus(function(){
if($(this).val().length  0){
this.select();
}
});

On blur is there a way in can unselect the selected text?



[jQuery] attr({'type':'hidden'}) in IE6

2007-08-26 Thread Minh

Getting an error when I tried to set a input attribute to hidden in
v1.1.2, v.1.1.3.1 and v1.1.4. Using $
(#inputID).attr({'type':'hidden'}) and $
(#inputID).attr(type,hidden).



[jQuery] Re: attr({'type':'hidden'}) in IE6

2007-08-26 Thread Minh

Stephan thanks for the explanations and Karl thanks for the
alternative solution.

Erik -
I have a form and after the user enter a value then it goes through
Ajax validation.  If it's validated then I  need to disabled or hide
it so the user can't edit it.  Problem with disabled is that when the
form is submitted disabled field doesn't get submitted.



[jQuery] Re: attr({'type':'hidden'}) in IE6

2007-08-26 Thread Minh

Erik-

Nope I'm just looking for a way to stop the user from editing the
field.  Setting it to readonly is good and the css will be a nice
visual cue.

Thanks.

On Aug 26, 11:19 pm, Erik Beeson [EMAIL PROTECTED] wrote:
  Ajax validation.  If it's validated then I  need to disabled or hide
  it so the user can't edit it.  Problem with disabled is that when the
  form is submitted disabled field doesn't get submitted.

 You can make it read only, and maybe make the text gray so it's a
 little clearer that it can't be edited:

 $('#inputID').attr('readonly', 'readonly').css('color', '#999');

 If you really want to convert it to hidden, just make a new hidden
 element and copy over the name and value properties.

 --Erik