Jump to content

Jquery toggle effect with insert record to the database.


deepson2

Recommended Posts

Hello,

 

Can we do the favorite/unfavorite song with jquery toggle effect?

 

Ex- if we click on one image(let say dull image which shows its not yet favorite song of the user )then it ll turn to the bright one(which indicates that now that thing is added as your favorite song into database.)

 

Can anyone know how can i do that?

 

Thanks in advance.

Link to comment
Share on other sites

Thanks for your thorpe,

 

That link show me to give alert messages once the insertion is done from the server side.

 

I want to do somthing like this:

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.js"></script>

  <script>
  $(document).ready(function(){

    $("li").toggle(

      function () {
        $(this).css({"list-style-type":"disc", "color":"red"});
      },
      function () {
        $(this).css({"list-style-type":"", "color":""});
      }
    );

  });
  </script>
  <style>
  ul { margin:10px; list-style:inside circle; font-weight:bold; }
  li { cursor:pointer; }
  </style>
</head>
<body>
  <ul>
    <li>My Favorite</li>

  </ul>
</body>
</html>

 

if i click on my favorite then it ll turn into red(here, but i want to show bright image over here)and that means that songs ll become my favorite song now. And if again i click on that image it ll become colorless(any dull image) that means i have removed that song from my list.

 

I hope this description make sense now. I have done this with radio buttons simply  but don't know how to do this with jquery.could you please guide me how can i do that?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.