Change div status for click events in JavaScript

Source: Internet
Author: User

<div class= "Setted-wrap j_channel_sets" >
<div class= "Setting-item" id= "K1" style= "display:none;" >
<div class= "fl cfx" ><span class= "setting-tit fl" title= "Single Choice" > Single topic </span> <em
Class= "FL" ><b>0</b> questions available </em></div>
<div class= "Setting-fun fr" ><input type= "text" name= "question_channel_type[1" "class=" warnning "
Value= "" placeholder= "0" > <i class= "del iconw-del2" ></i></div>
</div>
<div class= "Setting-item" id= "K2" style= "Display:none;" >
<div class= "fl cfx" ><span class= "setting-tit fl" title= "Fill in the blanks" > Fill in the Blanks </span> <em
Class= "FL" ><b>0</b> questions available </em></div>
<div class= "Setting-fun fr" ><input type= "text" name= "question_channel_type[4" "class=" warnning "
Value= "" placeholder= "0" > <i class= "del iconw-del2" ></i></div>
</div>
<div class= "Setting-item" id= "K3" style= "Display:none;" >
<div class= "fl cfx" ><span class= "setting-tit fl" title= "Computational Questions" > Computational questions </span> <em
Class= "FL" ><b>0</b> questions available </em></div>
<div class= "Setting-fun fr" ><input type= "text" name= "question_channel_type[6" "class=" warnning "
Value= "" placeholder= "0" > <i class= "del iconw-del2" ></i></div>
<div class= "Setting-fun fr" ></div>
</div>



<div class= "Smart-type-warp" >
<div class= "Smart-type-set j_channel_btns" id= "Ding" >
<a href= "javascript:;" title= "single-choice" id= "K1" > Single topic </a>
<a href= "javascript:;" title= "Fill in the blanks" id= "K2" > Fill in the Blanks </a>
<a href= "javascript:;" title= "calculation" id= "K3" > Computational questions </a>


The first step is to select the selected topic type status as the selected state
$ (document). Ready (function () {
$ ("#ding a"). Click (function () {
$ (this). AddClass ("selected");
The second step, change the topic of the selected topic type corresponding
var id = $ (this). attr (' id ');
document.getElementById (ID). style.display= "Block";

});

Change div status for click events in JavaScript

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.