0

I would like to show a text when user clicks on an icon. I have the following code block, but it is wrong. Can someone correct me:

<a class="icon-question-sign help_popup"
   onclick="javascript:$('#callback_help').toggle('fast', function() {
     $('#callback_help').html('xx');
   })">
</a>
4
  • 2
    It seems to be working jsfiddle.net/dfaevzbs What is the problem? Commented Sep 2, 2014 at 9:55
  • 1
    A very bad idea to use jQuery in inline event handler. Commented Sep 2, 2014 at 9:59
  • @Satpal that's for sure. Commented Sep 2, 2014 at 10:00
  • i dont know, why but above my code block didnt work. Rakesh's code is working for me Commented Sep 2, 2014 at 10:49

1 Answer 1

1

Fiddle Demo

You have to inlude jQuery library if you have not included :

<script src="http://code.jquery.com/jquery-1.10.2.js"></script>

Second you can try like this :

HTML :

<a class="icon-question-sign help_popup"></a>
<div id="callback_help"></div>

Jquery :

<script type="text/javascript">

$(document).ready(function(){

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

            $('#callback_help').toggle('fast', function() {
                  $('#callback_help').html('xx');
            });
       });

});

</script>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.