Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
171
rated 0 times [  172] [ 1]  / answers: 1 / hits: 19274  / 8 Years ago, sun, march 13, 2016, 12:00:00

I have this in HTML



<div class=aplplyevent>
<input type=hidden name=type value= />
<div class=hidden-div id=hidden-div>
Here is my form that is displayd on click and the button APPLY EVENT will disappear!(As long as my form already has a button!)
</div>
<span style=display:block><button class=btn btn-applyevent onclick=getElementById('hidden-div').style.display = 'block'; this.style.display = 'none'>APPLY EVENT</button></span>


This in CSS:



.hidden-div {
display: none;
}


On desktop devices works fine but on iOS and Adroid my main button APPLY EVENT do not disappear and I have 2 buttons, the main button(who stop to dissapear) and the form button.



iOS since v8 and now Android too seems to stop support for onclick.



Can someone please help me? I'm beginner in JS!



JSFiddle Here


More From » javascript

 Answers
22

I think its better to use jQuery. This might get thing done.



Html



<script src=//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js></script>
<div class=aplplyevent>
<input type=hidden name=type value= />
<div class=hidden-div id=hidden-div>
Here is my form that is displayd on click and the button APPLY EVENT will disappear!(As long as my form already has a button!)
</div>
<span style=display:block><button class=btn btn-applyevent id=buton>APPLY EVENT</button></span>


JS



$(document).ready(function(){
$(#buton).on('click touchstart',function(){
$(this).hide();
$(.hidden-div).css(display,block);
});
});

[#62952] Friday, March 11, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
mckenna

Total Points: 445
Total Questions: 109
Total Answers: 109

Location: Virgin Islands (U.S.)
Member since Sun, May 16, 2021
3 Years ago
;