Copy input value into a div tag
I'm trying to write code that will pull a specific value from an input tag in a javascript function and display it in a separate div tag to be used as a URL. I know it's a little convoluted, but it seems to be the best way I can figure out. Here's the abbreviated code I have so far:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
function init(){
[lots of code]
//JavaScript popup that pulls attributes from a map
var contenta = "<b>Building Type</b>: ${Type}" +
"<br /><b>Hours</b>: ${Hours}" +
"<br /><a target='blank' href=${FloorPlan}>Floor Plan</a>" +
开发者_Python百科 "<br /><input type='text' id='url' value=${BldgName}></input>" +
"<br /><button onclick=revealModal('modalPage') value/>" + button;
var bldginfo = new esri.InfoTemplate("${BldgName}", contenta);
</script>
<div id="modalPage">
<div class="modalBackground">
</div>
<div class="modalContainer">
<div class="modal">
<div class="modalTop"><a href="#" onclick="hideModal('modalPage')">[Close]</a></div>
<!-- Begin pop-up window edits here-->
<div class="modalBody">
<p>Map goes here. Buttons go to the right.</p>
<script type="text/javascript">
$(":hidden");
</script>
</div>
<!-- End pop-up window edits-->
</div>
</div>
What I'm trying to do is set it so that when the div modalBody loads, it's pulling the input from the input id='URL' in the init function. The input can already read the given value, it just needs to transfer. I'm pretty sure I've screwed up the jQuery somehow, and I'm also not sure that I even need it in the first place. I also don't know if the input tag being in the middle of a function is going to affect anything. I would appreciate any help I can get on this.
Have you looked at the jQuery UI site?
they have a dialog component, that I think you could use and save you a bit of work or at least give you an idea of how you can do it?
精彩评论