jquery - show hidden div when click value radio button -


hy guys show div when click on value radio button. html:

 <form id="risp">             <input id="ris1" type="radio" name="ris" value="err1">                     <label class="answer">0</label>             <input id="ris2" type="radio" name="ris" value="err1">                      <label class="answer"> 2</label>             <input id="ris3" type="radio" name="ris" value="correct1">                    <label class="answer">5</label>         </form>  <div id="correct">         <p>answer correct</p>     </div> 

so try function:

$("#ris3").click(function () {                         $("correct").show(); 

but don't function!!why?? thanx

it's because:

$('correct') 

should be:

$('#correct') 

the problem selector wrong. keep in mind selector $('correct') looking <correct> element not exist. ids, have use # , . classes either 1 before actual value. can find more information on jquery selectors here: http://api.jquery.com/category/selectors/

sample fiddle

note: stuart kershaw mentioned on comment below, remember close click function, otherwise won't work...


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -