As a beginner in jQuery I'm trying to understand how to handle .click().

My event click function :

<script language="javascript" type="text/javascript">
    $(document).ready(function() {

$('.del').click(function() {

        var lien = $(this).attr("title");

        $.post(lien, function(data) {



The span :

<span title="<?php echo base_url().'del/cat/'.$cat->idcategories ?>"class="del alignright">supprimer</span>

This works the first time but not after that. Is this happening because I'm using attr()?

Any explanation of the expected behavior would be very much appreciated.


Do you use a debugger like firebug? Does it say anything?

Written by joakimdahlstrom

This work with .live(...) Thank you evrybody.

Written by zourite

Accepted Answer

By the looks of it you sending a request to delete something... If your sending the request twice it's only going to delete once..

However Try

    var lien = $(this).attr("title");

    $.post(lien, function(data) {

Written by Eddie
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the community.
It is licensed under cc-wiki