I have two forms that are fairly identical located on different pages of a site. In order to call distinct jQuery ajax functions there are two class names I need to alter. For one of the pages, I place this script

<script>
    $(document).ready(function(){
        $(".itemDelete").switchClass("itemDelete","LibraryItemDelete");
        $(".itemEdit").switchClass("itemEdit","LibraryItemEdit");
    });
</script>

and it is not working. I have tried with that script loaded in the header or the footer. Most examples of switchClass I found on the net have examples where the trigger event is clicking on a div. Is what I am trying to do possible?

Recommended Answers

All 2 Replies

Hmm... did you remember to include the reference to the jQuery UI file(s)? The switchClass() is not part of jQuery core, its part of JQueryUI. Your code example seems to work fine..

jsfiddle demo >> http://jsfiddle.net/6XeyU/

Thanks, JorgeM. Newbie 101 mistake. Your suspicion was right.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.