Leonidus
Leonidus

Reputation: 448

How create a user interactive popup kind of form

I am looking for something which comes up as a popup on click of a link or button but It must be more than just a popup. It must be a Interactive form which asks for inputs and when Inputs are provided it takes The input back to the parent window. I am not asking for the code. I just don't know which kind of technology it is. Do you know what I am Talking about?

Upvotes: 0

Views: 3421

Answers (3)

Eugeny89
Eugeny89

Reputation: 3731

I can suggest doing something like the following. In JS:

$container = $("#container");
$("<div class=\"popup\" id=\"popup-id\"><!--html code of form here--><div>").hide().appendTo($container);
....
function showPopup() {
    $("#popup-id").show().offset({
    left : yourX,
    top : yourY
});

}

in HTML:

<!-- container of popup -->
<div id="container">
    ...
<div>
...
<a onclick="showPopup()">Show Pop Up</a>

in CSS

div.popup {
    display: inline-block 
}

That should work.

UPD. And even more. Instead of creating div with $("<div class=\"popup\" id=\"popup-id\"><!--html code of form here--><div>"). You can use jquery.tmpl() function.

Upvotes: 0

jabal
jabal

Reputation: 12347

1, Include jQuery into your HTML via <script src=..> 2, See this tutorial on how to create modal overlays via jQuery:

http://jquerytools.org/demos/overlay/modal-dialog.html

http://www.jacklmoore.com/notes/jquery-modal-tutorial

Upvotes: 1

Taff
Taff

Reputation: 231

With jQuery, in the child window (popup) you can call your parent window (the opener) and target a field therein with something like this:

$("#fieldInParent", opener.window.document).val("new value");

opener.window.document tells jquery that the ID is in the window that opened the popup.

Upvotes: 0

Related Questions