javascript - How to place close button to the end of popup box -


i have designed popup box placing popup button end of popup box when contents has been updated dynamically box,the close button moving out of box.

look code once

#overlay{     width: 100%;     height: 100%;     position: fixed;     top: 0;     left: 0;    }   #box_frame{     width: 100%;     position: fixed;     top: 30%;   }   #box{      width: 400px;      padding: 40px;      height: 200px;      margin: auto;      font-size: 14px;      background:#e8e8e8;      border: 1px solid #dadada;      font-family:sans-serif;    }    #box button{      margin-top: 45%;    } 

guys @ javascript code

function open_box(){       var cont = '<div id="overlay"><div id="box_frame"><div id="box"> '+               'select reviewer:<input type="text" name="name"      onkeyup="load(this.value);" autocomplete="off"/>' +               '<div id="demo"></div>'+               '<div id="check"></div>'+               '<button onclick="javascript:reset_dynamic()">close</button>'+               '</div></div></div>';       document.getelementbyid("dynamic").innerhtml=cont;     }     function reset_dynamic(){       document.getelementbyid("dynamic").innerhtml='';     } 

guys can please @ code , suggest me place code button end of popup box.here "demo" div holds dynamic content received ajax response.

html code:

<a href="javascript:open_box()">select icr reviewer</a> <div id="dynamic"></div> 

first should give button id (let's close_btn ) , give top , right absolute position:

#close_btn {     position: absolute;      top:3px;     right:3px     } 

and should give #box relative position :

 #box{      /* make absolute button       relative parent */       position: relative;     } 

and think don't need #box button rule


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -