Hide #right-answer2?

Hi m3g4pop

I needed to create a new thread to avoid confusing the topic.

I have this page below.
http://www.codesmastery.com/language/show_qa/general/init/

Now as you can see above the ‘done and compare’ button are two textareas left and right.
Now what I want is to hide the right textarea when the page loads.
I think the id of the right textarea is right-answer2

I tried many times.in jquery but failed.
I prefer jquery for easy coding.

How to do this?

Thanks in advance.

This is what I did so far,

   <script>
        var answer = "<?php  echo $ans ?>";
       
        $(function () {
            $("#right-answer2").hide();
            $("#reference").hide();
            
            $("#done").click(function(){
                $("#right-answer2").val(answer).show;
                $("#reference").show();     
                
            });
        });    
    </script>

but failed.

That code is throwing php errors at the moment but your js does look correct if the id’s match.

You’re missing brackets here though:

$("#right-answer2").val(answer).show();

I already added the bracket.

but still not hiding the textarea #right-answer2

Your scripting code will refuse to work when there are syntax errors.

The first error is when loading the script from http://www.codesmastery.com/language/show_qa/general/init/assets/js/vendor/modernizr-2.8.3.min.js

The script file is full of PHP errors. It needs to contain the moderizr scripting code instead.

I open the chrome conole.
And there are errors.
Now I don’t know how to fix them.
Any tutorial links or youtube videos for this?

Thanks in advance.

Answer ninja strikes again! :wink:

1 Like

@paul

Okay will try to fix.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.