Trigger a modal to show no a non click

I have a hidden modal that is want to trigger using data-toggle. But it needs to start on it's own. so without a click.

I can show the modal using a icon with a data-toggle like this:

<a href="#RemoveSerialNumberModal" data-toggle="modal"><i class="icon-plus"></i></a>

This shows the modal 'AddSerialNumberModal'.

Now do I wanna check if !empty($_GET['sn']) and if it isn't I wanna open the modal on it's own.

I tried it with JS like this:

$('#RemoveSerialNumberModal').modal();
$('#RemoveSerialNumberModal').modal(show);
$('#RemoveSerialNumberModal').data-toggle(modal);

But that doesn't work.

(I really wanna do it in JS).

-------------edit-------------

<script>alert('where here stage 1 tho!');
        $("#RemoveSerialNumberModal").dialog({modal: true});
        alert('where here stage 2 tho!');</script>

This is how I test this. When I run the example it alerts the first 1 but doesn't show the second alert. So it breaks somehow on the code in the middle.

Answers


you can trigger click function if other way are not working to show modal

<a id="someid" href="#AddSerialNumberModal" data-toggle="modal"><i class="icon-plus"></i></a>

$('#someid').trigger('click');

Need Your Help

Using saved ggplot2 figure with shiny in r

r ggplot2 shiny render

I want to plot a density plot of figure save it and render it in the shiny app. What I want to add to the figure dynamically is a line from input showing where the new entered variable lies in the

Listing functions of an unmanaged DLL at runtime in c#

c# reflection dll unmanaged

Is it possible to obtain a list of functions declared in an unmanaged DLL? I want to create this list in a c# program.