0

THE SCENARIO:

In the html example showed on the link below, i have multiple checkboxes which when you click it must show or hide:

THE EXAMPLE:

Based on link below, when you open the specific page, it must show the folowing checkboxes:

All, District, Area, Category, Restaurant, Shop, Houses

If you click for example on District it will show you just District1, and if you click District1 it will show you District2 and the opposite if you uncheck. But in the same time when you click District1 for example it will show you if you have just Restaurants and Shops.

I added the link from jsfiddle with the html code.

THE QUESTION:

Can someone do the javascript? Because i do not know javascript

Thank you in advance,

The example

wulffgarr
  • 25
  • 5
  • You can learn javascript and try your self if any problem then we are help. – Hkachhia Sep 13 '12 at 09:10
  • If you know other programming languages, you'll see that javascript is not difficult :S... (And you'll like it!!! :P) You may also wanna take a look at jQuery http://jquery.com/, which makes things much easier – Littm Sep 13 '12 at 09:11
  • I am still unsure about what you really want to achieve ?? My questions : - On page load , only All , District , Area and Category these checkboxes visible to user ?? and when he checks one of the checkboxes then further checkboxes should be visible to him ?? is that the case ?? i.e. if I check District then Dis1,Dis2,Dis3 would be visible ?? and what about remaining checkboxes i.e. Restaurant,shop , houses ?? Your question too difficult to understand – Ashes Sep 13 '12 at 09:11
  • I understand, but i know only html and css and honestly i do not have time now. But thank you for your advice :) – wulffgarr Sep 13 '12 at 09:12
  • Yes Ashes when the page loads it shows just All, District, Area, Category, if you click District for ex it will show District1 and if you click District1 it will show District2 – wulffgarr Sep 13 '12 at 09:14
  • And if you click the District for example it will show if are Restaurants Shops or Houses – wulffgarr Sep 13 '12 at 09:15
  • But what about other remaining 3 checkboxes ?? – Ashes Sep 13 '12 at 09:15
  • You refer to Restaurant, Shop, Houses? yes it must be shown or hidden if for example District1 have Restaurant, Shop, Houses. If you click District1 and it has just Houses it will show just Houses – wulffgarr Sep 13 '12 at 09:21
  • http://stackoverflow.com/questions/4249618/checkboxes-jquery-hide-show?rq=1 check this question which might help you further more – Ashes Sep 13 '12 at 09:46

1 Answers1

1
$('.district').hide();
$("#district").on('change',function () {
    if(this.checked)
    {
        $('.district').show();
    }
    else
    {
        $('.district').hide();
    }
});​

Check This Edit

Sender
  • 6,660
  • 12
  • 47
  • 66