Dinesh T
Dinesh T

Reputation: 3

How to create a pop up window asking for input using jquery

My index.html code is

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Ember Starter Kit</title>
  <link rel="stylesheet" href="css/normalize.css">
  <link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/one.css">
</head>
<body>

<!--Script1-->

  <script type="text/x-handlebars">
    <div id="W">
<h1> Welcome </h1>
</div>

<div id="section1">
<h2>   {{#link-to 'DINESH'}} DINESH {{/link-to}}  </h2>
</div>

<div id="section">
<h2> {{#link-to 'HOME'}} HOME {{/link-to}} </h2> 
</div>

<div id="section2">
<h2> {{#link-to 'CLICK'}} CLICK {{/link-to}} </h2> 
</div> 

 {{outlet}}

  </script>

  <!--Script2-->

  <script type="text/x-handlebars" id='HOME'>
  <div class-'HOME'>
  <p>
    This is a sample site for practicing Ember.js 
  </p>
  </script>

  <!--Script3-->

   <script type="text/x-handlebars" id='DINESH'>
  <div class-'DINESH'>
  <p>
     I welcome you to my page.. keep in touch......!!!!!
  </p>
  VIDIYAL
<br>

   Being the "Director of Community Service" in Rotaract Club of Future League, I organised a project called "VIDIYAL" where i taught basic computer knowledge to Orphanage Students. 
  </script>

  <!--Script4-->

  <script type="text/x-handlebars" id='CLICK'>

<div class-'CLICK'>
<p> Click the button to display the information which you want: </p>

<button onclick="myFunction()">Click me</button>

<p id="CLICK"></p>

<script>
function myFunction() {
    document.getElementById("demo").innerHTML = "Hello World";
}



  </script>


  <script src="js/libs/jquery-1.10.2.js"></script>
  <script src="js/libs/handlebars-v2.0.0.js"></script>
  <script src="js/libs/ember-1.9.1.js"></script>
  <script src="js/app.js"></script>
  <!-- to activate the test runner, add the "?test" query string parameter -->
  <script src="tests/runner.js"></script>
</body>
</html>

and app.js code is

App = Ember.Application.create();

App.Router.map(function()
{
    this.resource('HOME');
    this.resource('DINESH');
    this.resource('CLICK');
});

If i click it should display a pop-up window asking for my name ("Enter your name").

I am a student who is very new to programming. So kindly explain me as simple as you can.

Upvotes: 0

Views: 3358

Answers (2)

dr_dev
dr_dev

Reputation: 522

You can do this in pure javascript. prompt() method will do this for you. Check here

If you want to do this in Ember.js, you need to open a modal, on the user click. Created a Fiddle http://jsfiddle.net/rocky_217/uxa38xjz/4/

Upvotes: 2

Akash kumar
Akash kumar

Reputation: 1053

You can use prompt() function in jquery or js to receive input in popup. check out the code -:

<script>

var childAge =  prompt("Enter Child  age")
alert(childAge);

</script>

Upvotes: 1

Related Questions