Reputation: 41
I am trying to add image and button click to jquery dynamically. The image doesn't show. Below is my code.
$("<div/>", { id: "hide" })
.append('<img src="/Content/Images/alert.png" style="margin-left: auto; margin-right: auto; display: block;" alt="" />')
.append('<button runat="server" autofocus id="myButton" type="button" style="margin-left: auto; margin-right: auto; display: block;">OK</button>');
$("#myButton").click(function () {
$("#hide").hide();
});
Upvotes: 2
Views: 358
Reputation: 41
I have finally got it working the way I want. I have created an html page for the redirect. I have also marked some of my controllers with
[SessionState(System.Web.SessionState.SessionStateBehavior.ReadOnly)]
Then in my Glbal.asax Session_Start I check if the Session is not IsReadOnly Redirect to the html page
Upvotes: 0
Reputation: 171669
You are creating a new element in memory and appending to that but not to the DOM.
Change:
$("<div/>", { id: "hide" }).append...
To:
$("#hide").append...
Upvotes: 1