<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://gitcdn.github.io/bootstrap-toggle/2.2.2/js/bootstrap-toggle.min.js"></script>
<script>
function changeStatus() {
var confirmMsg = "Are you sure you want to change the status?";
if(confirm(confirmMsg))
{
console.log("yes");
}
}
</script>
<link href="https://gitcdn.github.io/bootstrap-toggle/2.2.2/css/bootstrap-toggle.min.css" rel="stylesheet">
<td style="verticle-align:middle">
<input
type="checkbox"
id="toggleSwitch"
name="toggleSwitch1"
data-toggle="toggle"
data-on="Enabled"
data-off="Disabled"
data-onstyle="success"
data-offstyle="danger"
data-confirm="Are you sure?"
data-size="normal"
onClick="changeStatus()"
/>
</td>
<td style="verticle-align:middle">
<input
type="checkbox"
id="toggleSwitch"
name="toggleSwitch1"
data-toggle="toggle"
data-on="Enabled"
data-off="Disabled"
data-onstyle="success"
data-offstyle="danger"
data-confirm="Are you sure?"
data-size="normal"
onClick="changeStatus()"
@if($organisation->status == 1) checked @endif
>
</input>
</td>
This is my checkbox in my table. I tried to the scripts required for the bootstrap toggle.
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<link href="https://gitcdn.github.io/bootstrap-toggle/2.2.2/css/bootstrap-toggle.min.css" rel="stylesheet">
<script src="https://gitcdn.github.io/bootstrap-toggle/2.2.2/js/bootstrap-toggle.min.js"></script>
<script>
function changeStatus() {
var confirmMsg = "Are you sure you want to change the status?";
if(confirm(confirmMsg))
{
console.log("yes");
}
}
</script>
So now my problem is, when I add those script the changeStatus method is not executing. May I know what is causing this issue here?
I tried remove the scripts
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<link href="https://gitcdn.github.io/bootstrap-toggle/2.2.2/css/bootstrap-toggle.min.css" rel="stylesheet">
<script src="https://gitcdn.github.io/bootstrap-toggle/2.2.2/js/bootstrap-toggle.min.js"></script>
and it is executing the method. But when I add back those scripts the method is not getting executed.