1

I know the title is familiar, but the answers weren't !

The answers here :

Button onclick event not working in iOS unless you go away from app and back, then it works

OnClick not Working on Ios11

Safari on iOS 9 does not trigger click event on hidden input file

onclick event doesn't work on iphone

Click events not firing on iOS

How do I use jQuery for click event in iPhone web application

jQuery click events not working in iOS

JavaScript OnClick not working on iOS

Make onclick work on iphone

https://www.quirksmode.org/blog/archives/2010/10/click_event_del_1.html

https://www.quirksmode.org/blog/archives/2010/09/click_event_del.html

didn't work for me, so before marking this question as duplicate, check my code :

THIS IS HTML :

<script>
    function showalert() {
        alert("I am an alert");
    }    
</script>
<div id="replace1" >
    
    <br><br><br>
    <a class="btnxyspace" onClick="alert("sometext");"><input type="button" value="Hi"></a>
<!--    <button value="HI" onclick = "showalert();">-->
    
    <br><br><br>
    
</div>

THIS IS THE CSS :

@import url('https://fonts.googleapis.com/css?family=Montserrat:100,100i,300,300i,4 00,400i,700,700i,900,900i');

* {
  font-family: Montserrat;
  font-size: 14px;
}

  .U3Gxm-butn {
    border: 1px solid #E77817;
    -webkit-border-radius: 15px;
    border-radius: 15px;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    padding: 10px 5px;
    color: #E77817;
    cursor: pointer;
    background:white;
    margin:0 auto 10px;
    width: 100%; /* Set a width if needed */
    display: block; /* Make the buttons appear below each */
float: left;
  }
  .U3Gxm-butn:focus, .U3Gxm-butn:hover {
    background: #E77817;
    outline: 0;
    color: #fff;
  }

.actn-disabled{
    cursor: not-allowed !important;
    background: #dddddd !important;
    color: black !important;
    pointer-events: none;
}

.actn-selected{
    background: #fba250 !important;
    color: black !important;
}

#loading 
{
    width: 100%;
    height: 100%;
    top: 0px;
    left: 0px;
    position: fixed;
    display: block;
    opacity: 0.7;
    background-color: #fff;
    z-index: 99;
    text-align: center;
}

#loading-image 
{
    position: absolute;
    top:30%;
    left: 40%;
    z-index: 100;
}



td { 
    word-wrap: break-word; 
} 




/* Below class use for op position */

.xspace{
    position: relative;
    top: 20px;
}

.xspace:first-letter{
    position: relative;
    top: 20px;
    text-transform: capitalize;
}

.xspacedown:first-letter{
    padding-bottom: 0%;
    text-transform: capitalize;
}

.xspaceop{
    position: relative;
    top: 50px;
    style:overflow-x:auto;
}

.xyspace:first-letter {
  text-transform: capitalize;
}

#replace1 > .xyspace{
    display:inline-block;
}

#replace1 > .xyspace:first-letter{
    text-transform: capitalize;
}

.ntfnbkpjob1{
    cursor:pointer;
}

I have created separate HTML and CSS files in my xCode project and this is how i am loading my html file in swift :

let url = Bundle.main.url(forResource: "webview", withExtension: "html")
webView.loadFileURL(url!, allowingReadAccessTo: url!)

Have tried everything possible, changed CSS to cursor:pointer, did everything mentioned in these solutions, nothing seems to work.

These solutions might be relating to their problem. Every problem has different answer !

Can anyone suggest anything that works in this scenario ?

Ashish Bahl
  • 1,482
  • 1
  • 18
  • 27

1 Answers1

0

<a class="btnxyspace" onClick="alert("sometext");"><input type="button" value="Hi"></a>

Shouldn't your on click look like this onClick="alert('sometext')" ?

I'm guessing you are talking about this one as button is commented out.

Najdan Tomić
  • 2,071
  • 16
  • 25
Mal
  • 1