Tag Archives: jquery

jQuery plugin for Twitter OAuth via popup window (Facebook style)

Disqus and some applications are using Twitter OAuth, but their user flow is not sequential single window process. A child window comes up, then it shows twitter.com and user can click Deny/Allow through that popup. When the user hits the deny or allow button, the popup will be closed immediately and the parent window will […]

Posted in Create | Also tagged , , , | Comments closed

jQuery validation: required and minlength for dynamic fields

This is not a smart way though, but I tried to code for a bit complexed form. Demo. Code snippet: $(’form input[type=button]’).click(function(){ $(’ul’).show().append('<li><input class="hidden" type="checkbox" name="list[]" value="1" checked="checked" />’ + $(’select[name=item_name] option:selected’).html() + ‘&nbsp;’ + $(’select[name=price] option:selected’).html() + ‘&nbsp;<a>remove</a></li>’); $(’ul li a’).click(function(){ $(this).parent().fadeOut(’slow’, function(){ $(this).remove(); }); }); }); var validator = $(’form’).validate({ rules: { ‘list[]’: […]

Posted in Tweak | Also tagged | Comments closed

Get error message “G is null” or “a is null” on jQuery

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script> <script> $(document).ready(function(){ var obj = null; // …maybe there are long lines… $.each(obj, function(){ }); }); </script> Will get an error message “a is null”. When using jquery.min.js, it might be hard to recognize what kind of error it is. On version 1.3.2 the message says “G is null”. You can’t pass null […]

Posted in Tweak | Also tagged | Comments closed

Load remote CSS file dynamically with jQuery

The below code loads a CSS file dynamically. It’s relatively easy to load all CSS files from the beginning, or just append a link element (ref. Switch stylesheets with jQuery). But it rarely needs to load a file dynamically and wait until those new CSS properties are ready to render new HTML elements. test.html: <html> […]

Posted in Tweak | Also tagged , | Comments closed