How to display and hide radio

Source: Internet
Author: User
Tags php foreach
How to display and hide radio and query a set of single-choice questions from the database,

    
 $ V) {?>
 
 
  • ,
  • Yes
  • No
  • ?


The code above is the code displayed on the page after it is queried from the database,
How can I display only one UL?
After clicking the radio button, hide the current UL and display the next UL?


Reply to discussion (solution)

JQuery makes it easy to implement

Give each ul a class related to $ key, such as class = "ul _". $ k

Then, give raido a click event. when clicked, find the ul of class = "ul _" + k in its parent class and hide it ($ (". ul _ "+ k ). hide ();) and show the ul of class = "ul _" k + 1 $ (". ul _ "k + 1 ). show ();

In addition, ajax is recommended for questions. Currently, dom only selects one question and sends it to the background for the next question.

JQuery makes it easy to implement

Give each ul a class related to $ key, such as class = "ul _". $ k

Then, give raido a click event. when clicked, find the ul of class = "ul _" + k in its parent class and hide it ($ (". ul _ "+ k ). hide ();) and show the ul of class = "ul _" k + 1 $ (". ul _ "k + 1 ). show ();

In addition, ajax is recommended for questions. Currently, dom only selects one question and sends it to the background for the next question.
How do I use ajax?


JQuery makes it easy to implement

Give each ul a class related to $ key, such as class = "ul _". $ k

Then, give raido a click event. when clicked, find the ul of class = "ul _" + k in its parent class and hide it ($ (". ul _ "+ k ). hide ();) and show the ul of class = "ul _" k + 1 $ (". ul _ "k + 1 ). show ();

In addition, ajax is recommended for questions. Currently, dom only selects one question and sends it to the background for the next question.
How do I use ajax?

Just like ajax, upload the number of the current question to the background to retrieve the next question, and then replace the retrieved content with the current content.



JQuery makes it easy to implement

Give each ul a class related to $ key, such as class = "ul _". $ k

Then, give raido a click event. when clicked, find the ul of class = "ul _" + k in its parent class and hide it ($ (". ul _ "+ k ). hide ();) and show the ul of class = "ul _" k + 1 $ (". ul _ "k + 1 ). show ();

In addition, ajax is recommended for questions. Currently, dom only selects one question and sends it to the background for the next question.
How do I use ajax?

Just like ajax, upload the number of the current question to the background to retrieve the next question, and then replace the retrieved content with the current content.
Do not understand ajax




JQuery makes it easy to implement

Give each ul a class related to $ key, such as class = "ul _". $ k

Then, give raido a click event. when clicked, find the ul of class = "ul _" + k in its parent class and hide it ($ (". ul _ "+ k ). hide ();) and show the ul of class = "ul _" k + 1 $ (". ul _ "k + 1 ). show ();

In addition, ajax is recommended for questions. Currently, dom only selects one question and sends it to the background for the next question.
How do I use ajax?

Just like ajax, upload the number of the current question to the background to retrieve the next question, and then replace the retrieved content with the current content.
Do not understand ajax
Sorry, that's why I went far. I can use the method I mentioned earlier.


In addition, ajax is very important in current website development... and it is very simple. you can learn it in half an hour (JQuery's ajax ).
If necessary, you can search for the relevant information and check out any ideas or questions.

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.