Nov
01
2006
TexoTela has a nice jQuery plugin to manipulate select boxes. You are able to add, remove and sort options with his plugin.
Well, that wasn’t the feature I needed. I needed a plugin to select a specific option via JavaScript. The option(s) should be selected by value. So I have extended the plugin with the functionality to select an option by value:
$("#myselect").selectOptions("val1");
The code can be found here.
Okt
30
2006
[Update] There was an error using more than one box and class selectors. It is fixed now (thanks @Justin) [/Update]
Sometimes, you have the design problem that you want to fit a text into a given box. If the text is small, the font-size should be bigger. If the text is big, the font-size should be smaller.
For this problem, I have written a jQuery-Plugin: You have to put your text into a block element (p.e. a div-element) and to specify width and height of this box. Additionally you have to set an initial font-size in “px”
#testBox {
width: 400px;
height: 50px;
font-size: 20px;
}
Now, you only have to call the fit2Box function:
$("#testBox").fit2Box();
You can view a demo and download the code. Have fun!
The code is tested on
- Internet Explorer 6.0
- Internet Explorer 7.0
- Firefox 2.0
- Opera 9
Okt
28
2006
– Version 2 is avaiable –
jQuery is a fantastic JavaScript library with a fast growing community. In my opinion, the library has a lot of advantages against other libraries:
- It is fast
- It is easy to use
- …. (I think you have to use it to see the advantages)
One big advantage is the plugin-possibility. If you want not to write the same code every time, the library gives the possibility to write a plugin, you can use every time.
In this way, I want to publish my plugins at this page: today the getURLParam.
This plugin can be used to get the URL parameters. You have to specify, which parameter you want. If the parameter does not exist, you will get “null”.
var param1 = $.getURLParam("userID");
Even testing, if a specific parameter exists, is easy:
if ($.getURLParam("userID")==null) {
alert("There is no userID");
}
The code can be found here.