Filed Under (jquery) by admin on 14-12-2011
I have just stumbled on this performance tip so I tried and tested it, so far the results were good there are some speed improvement on my jquery codes.
Optimize selectors for Sizzle’s ‘right to left’ model
As of version 1.3, jQuery has been using the Sizzle Javascript Selector Library which works a bit differently from the selector engine used in the past. Namely it uses a ‘right to left’ model rather than a ‘left to right’. Make sure that your right-most selector is really specific and any selectors on the left are more broad:
var linkContacts = $(‘.contact-links div.side-wrapper’);
instead of:
var linkContacts = $(‘a.contact-links .side-wrapper’);
More tips from this website
http://dumitruglavan.com/jquery-performance-tips-cheat-sheet/
Filed Under (jquery) by admin on 27-12-2009
Tagged Under : jquery
Filed Under (jquery) by admin on 01-12-2008
Tagged Under : jquery
To dynamically change the table rows use this smart approach using jquery
Assign your new table data rows to a variable
var msg="<tr><td>Kristine</td><td>18</td><td>peach</td></tr><tr><td>Vanessa</td><td>25</td><td>strawberry</td></tr>";
Delete the exsiting rows except for the header tr:first – represents first row of the table – which happens to be our header
$("table tr:first").siblings().remove();
Then add the new data, the msg javascript variable used here holds the new table rows data
$("table tr:first").after(msg);
I have a very detailed step by step tutorial you can view here
Filed Under (jquery) by admin on 08-10-2008
From Smashing Magazine
Rule #1: Separate Javascript Functionality
Bad markup:
Never include Javascript events as inline attributes. This practice should be completely wiped from your mind.
- <a onclick=“doSomething()” href=“#”>Click!</a>
<a onclick="doSomething()" href="#">Click!</a>
Good markup:
All Javascript behaviours should be included in external script files and linked to the document with a
- <a href=“backuplink.html” class=“doSomething”>Click!</a>
<a href="backuplink.html" class="doSomething">Click!</a>
And the Javascript inside the myscript.js file would contain something like this:
Filed Under (jquery) by admin on 08-10-2008
Tagged Under : jquery
A jquery plugin that creates a multiple column selectbox
Donwload plugin at: http://code.google.com/p/jquerymulticolumnselectbox/

Directions for Use:
1. Include of course jquery.js and jquery.multicolselect.js
<script type=”text/javascript” src=”jquery.js”></script>
<script type=”text/javascript” src=”jquery.multicolselect.js”></script>
2. Create a table put an id to the div “ex. datatable”
<div id=”datatable”>
<table cellspacing=”0″ width=”100%”>
<tr>
<th>ID</th><th>Key</th><th>Fruit</th>
</tr>
<tr>
<td>1</td><td>1234</td><td>Apple</td>
</tr>
<tr>
<td>2</td><td>1111</td><td>Cat</td>
</tr>
<tr>
<td>3</td><td>5555</td><td>Dog</td>
</tr>
</table>
</div>
3. Run the plugin using this command
$("#datatable").multicolselect({
buttonImage:"selectbutton.gif",
valueCol:1,
hideCol:0
});
4 . Note you need the “selectbutton.gif” so save it.
5. Then your done.
Options
| buttonImage |
The source of your button image |
|
| valueCol |
The column index to be used to display value for the textbox |
|
| hideCol |
The column index to hide this is usually an id column |
|