jquery

jquery Form Hint plugin (mine)

This is my view of form hint plugin: show a div over with the title content inside, instead of replace text in input elements and match it with placeholder
simply run $(selector).formHint() on all form element and title is used as hint


Ajax frontend for my backoffice in jQuery and PHP

This is my way to organize php for a simple jQuery frontend ajax based:

1.in a administration page include the php that generate html for each box
2.for each box setup behavior in Javascript
3.let each php manage POST request (for change/update) and GET request for show content


So in admin.php we could have something like that

<img src=”button.png” id=”btn_change” />

Option List jQuery plugin

A plugin for display list of item to insert.
List item are stored in input hidden comma separed, the call is simple
Some bug to fix

options are

  • target: target div to update with options
  • input: input to update with values
  • items: items list as key:value
  • optional: default to $("<input>").attr("type","text") ... you can setup autocomplete
  • preset: an array of key preset (must be in items)
$("#morelink").optionlist({
	  target:'#optionlist',
	      input: '#iptvalues',
	      items: {'0':'prova','1':'test','2':'due','3':'tre'},
	      preset: [0]
	  });
moreitem
.optionlist_itemlist {
position:absolute;
display:none;
border:1px solid #000;
padding:2px;
background:#fff;
z-index:3001;
}
.optionlist_additem{
 cursor:pointer;
  color:blue;
 }
.optionlist_additem:hover{
  text-decoration:underline;
 }
.optionlist_item{
 width:100px;
  float:left;
 }
.optionlist_rmitm{
 position:absolute;
  background: #999;
 opacity:0.7;
 display:none;
 cursor:pointer;
}

also #optionlist_overlay is the overlay at z-index:3000

jQuery Waiting plugin

This is a simple jQuery plugin for purpose of loading phase of an ajax request or anything else.
$("#testdiv").waiting({imgsrc:"/files/aj-blue.gif"});
to stop a waiting div
$("#testdiv").stopWaiting();
TEST DIV
CLICK ME

move multiple option in select with jQuery

I look for this everywhere: how to move multiple option inside a select
function upfield() {
  var el = $('#selectedfield').children('[@selected]:first').prev();
  $("#selectedfield")
    .children('[@selected]')
    .each(function(){
	$(this).insertBefore(el);
      });

}

function downfield() {
  var el = $('#selectedfield').children('[@selected]:last').next();
  $("#selectedfield")
    .children('[@selected]')
    .each(function(){
	$(this).insertAfter(el);
	el = $(el).next();
      });
}
Syndicate content