Toggle view of modal button
I have the following modal dialog:
$(document).ready(function() {
$( "#addLocation" ).dialog({
modal: true,
height: 820,
width: 550,
buttons: {
"Add Location": function() {
document.forms['mapform'].submitted.value='1';
document.forms["mapform"].submit();
开发者_运维问答 },
Cancel: function() {
$( this ).dialog( "close" );
}
},
});
});
How can I toggle the 'Add Location' button? I want it to display only when a certain button within the dialog is clicked.
Thanks,
You can do it like this:
hide you add location button as soon as dialog is shown on screen. call this after the dialog open command
$("button[value='Add Location']").hide();
Then add event to the desired button that will toggle the add location button
$("buttonid or any selector").click(function(){ $("button[value='Add Location']").show(); });
精彩评论