Here's one possible solution:

$(document).ready(function(){
   $('.edit').click(function(){
          alert('Edit');
          $(this).removeClass().addClass('save').unclick().click(saveHandler);
          return false;
   });
   // you only need the following line if there are elements with
   // class == save when the doc is loaded
   $('.save').click(saveHandler);
});

function saveHandler() {
   alert('Save');
   return false;
};


Mike


On 6/8/07, Green Tea <[EMAIL PROTECTED]> wrote:

Here is my code:

<script type="text/javascript">
$(document).ready(function(){
// edit
$('.edit').click(function(){
        alert('Edit');
        $(this).removeClass().addClass('save');
        return false;
});
// save
$('.save').click(function()
{
        alert('Save');
        return false;
});
});
</script>

<a href="test.htm" class="edit">Test</a>

It always alert "Edit", but class changed to "save".
How i can get access to element with class "save"?


Reply via email to