Php, how to deal with it

Source: Internet
Author: User
Php, if () {} else & nbsp; {echo & quot; & lt; script & gt; $ (document ). ready (function () {$ (. captcha ). hide () ;}); & lt; script & gt; & quot ;;...... php code, omitted here} the result I want is the php,
If (){}

Else
{
Echo "script"
$ (Document). ready (function () {$ ('. captcha'). hide ();});
Script ";
... Php code, omitted here
}

The result I want is to hide the css of captcha class on the page when else is executed. But the code written above seems wrong. how can I add jquery code to the php judgment statement?

------ Solution --------------------
If the code is correct

PHP code
Echo <
  ------ Solution --------------------
Discussion

The third floor is incorrect,

------ Solution --------------------
This is easy

If (){

} Else
?>
Script // jquery script
}
?>
------ Solution --------------------
"; If this is more, add more points. what should I do if I have less points?
------ Solution --------------------
This JS code should be placed after the jquery. js file is introduced.


The key to the problem is what the html code output to the client is.
------ Solution --------------------
I already told you

But remember, this output must be controlled after your captcha has been properly output; otherwise, it will be invalid.

So you should output a hidden value in php, for example
Echo'';

After loading the entire page, perform corresponding operations based on this value.
JScript code
$ (Document ). ready (function () {if ($ ('# fool '). val () = 'false') {// execute code $ ('. captcha '). show ();}});
------ Solution --------------------
Discussion

Else
{
?>
Script
$ ('. Captcha'). show ();
Script

That's not the case.

------ Solution --------------------
You need to understand that php is running on the server, while js and jquery are running on the client, so when the html tag you need to operate is not displayed on the client, jquery cannot operate on the code. By understanding this, you will know how to do the rest.
------ Solution --------------------
Forget it. I will tell you a trick. if you are a normal person, I will not tell him. remember to give it a score ..

PHP code

    
    
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.