[jQuery] jQuery and multiple forms in page

[jQuery] jQuery and multiple forms in page


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>
<li>Word 1 (x)</li>
<li>Word 2 (x)</li>
<li>Word 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? :)













































    • Topic Participants

    • erik