[jQuery] jQuery and multiple forms in page

2009-07-26 Thread Ayah

Hello!
i need help with one thing, i have a list with words generaded via
mysql.
And i want to have an x in the end of every word, so i can easily
delete one in my list.
And ofc i wants some fadeOut effect on it.
I made it work but only with one, not with a whole list of words.

So tired to make a function of it, but it dosent work.

eg.
ul
   liWord 1 (x)/li
   liWord 2 (x)/li
   liWord 3 (x)/li
/ul

script
function removeSearchword()
{
var sokord_id = $(#sokord_id).val();
var register_id = $(#register_id).val();
var sokordet = $(#sokordet).val();



$.post(?=base_url()?index.php/adminpanel/testformremove,
{ sokord_id: sokord_id, register_id: 
register_id },
function(data){
$(#searchword_+ 
sokordet).slideUp(normal, function() {

$(#searchword_+ 
sokordet).before('');
});
}
);
return false;
}
/script

HTML
div id=searchword_list
div id=searchword_foo
?=form_open('')?
div style=display:none
?=form_input('sokord_id', '3', 
'id=sokord_id')?
?=form_input('register_id', '1', 
'id=register_id')?
?=form_input('sokordet', 'foo', 
'id=sokordet')?
/div
foo a href= 
onclick=removeSearchword()x/a

?=form_close()?
/div
  /div

is there some that can help me? :)


[jQuery] jQuery + Ajax request

2009-07-26 Thread Ayah

Hello!
Im trying to build a AJAX request with jQuery,
the function should work like this.
I have a list of words like this.
[code]
ul id=searchword_ul
 li id=searchword_kuken
 ?=form_open('adminpanel/testformremove')?
 div style=display:none
 ?=form_input('sokord_id', '3', 'id=sokord_id')?

 ?=form_input('register_id', '1',
'id=register_id')?
 ?=form_input('sokordet', 'kuken',
'id=sokordet')?
 /div
 kuken a href= id=removeSearchwordx/a
?=form_close()?

 /li
 li id=searchword_test
 ?=form_open('adminpanel/testformremove')?
 div style=display:none
 ?=form_input('sokord_id', '3', 'id=sokord_id')?

 ?=form_input('register_id', '1',
'id=register_id')?
 ?=form_input('sokordet', 'test',
'id=sokordet')?
 /div
 test a href= id=removeSearchwordx/a
 ?=form_close()?
 /li
 /ul
  /div
[/code]

and a Javascript like this
[code]
$(#removeSearchword).click(function(){
var sokord_id = $(#sokord_id).val();
var register_id = $(#register_id).val();
var sokordet = $(#sokordet).val();


$.post(?=base_url()?index.php/adminpanel/
testformremove,
   { sokord_id: sokord_id, register_id: register_id },
   function(data){
$(#searchword_+ sokordet).slideUp
(normal, function() {

$(#searchword_+ sokordet).before('');
});
}
);
return false;
});
[/code]

The problem im having, is that i can only press the x (remove) link
on the first one, not on the next one. Nothing happens when i press
the secound x.

Why is that?


[jQuery] Multiple instace of Dialog

2009-01-13 Thread Ayah

Hi,
Im building a search engine for my website.
And i want to have a button on each searchresult that a dilog will
showup with more info.
Like this:
Searchresult:
Google.se
(button)
--
Yahoo.com
(button)

and so on...

But i dont know how to crate a dynamic javascript for the dialog
function.
AS i understand it when u do like this.
script language=javascript type=text/javascript
$(document).ready(function() {
// Tell jQuery that our div is to be a dialog
$('#dialogTest').addClass('flora').dialog({
autoOpen: false
});

$('#bttn1').click(function() {
$('#dialogTest').dialog('open');
});
});
/script

Its static only to the bttn1.

Who to do the script dynamic to work with every ID bttn1?