Answer the question
In order to leave comments, you need to log in
jQuery UI Dialog, how to hang an event on click of a link inside it?
Now the code looks like this:
<br>
<div id="address-wrapper"><br>
<a id="address-select" href="#" title="Нажми">Нажми</a><br>
</div><br>
<br>
<div id="dialog-form" title="Выберите ваш город"> <br>
<label for="search">Поиск</label><br>
<input type="text" name="search" id="search" class="text ui-widget-content ui-corner-all" /><br>
<input type="button" name="post" id="search-button" value="Поиск" /> <br>
<br /><br /><br>
<div id="results"></div><br>
</div><br>
<br>
<script type="text/javascript"> <br>
function searchSubmit() {<br>
$.ajax({ type: "POST", <br>
url: "gni_ajax.asp", <br>
data: "query=" + $("#search").val(),<br>
success: function(data){<br>
$("#results").empty();<br>
$("#results").append(data);<br>
return false;} <br>
});<br>
};<br>
<br>
$('#search').keypress(function(event) {<br>
if (event.keyCode == '13') {<br>
searchSubmit();<br>
} <br>
});<br>
<br>
$("#search-button").click(function () { searchSubmit(); });<br>
<br>
$("#dialog-form").dialog({<br>
autoOpen: false,<br>
height: 400,<br>
width: 400,<br>
modal: true,<br>
buttons: { <br>
"Отмена": function() {<br>
$( this ).dialog("close");<br>
}<br>
},<br>
close: function() {<br>
alert("i'm closing!");<br>
}<br>
});<br>
<br>
$("#address-select").click(function() {<br>
$( "#dialog-form" ).dialog( "open" );<br>
});<br>
<br>
$(".addr").click(function() {<br>
alert($(this).text());<br>
alert(this.id);<br>
<br>
$("#dialog-form").dialog("close");<br>
});<br>
<br>
</script><br>
<br>
<a href="#" id="7700000000000" class="addr">Москва г</a><br>
Answer the question
In order to leave comments, you need to log in
for hanging events on elements that do not yet exist, there is this bind and live
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question