I am new to Javascript. I am using jQuery 1.11.0 and jQuery UI 1.10.4 and a plugin mask. I call the function closeDialog in code behind. I am getting the error 0x800a139e - JavaScript runtime error: cannot call methods on dialog prior to initialization; attempted to call method 'close'. I have searched all over but to no avail. How do I initialize the dialog? Any help is appreciated.
<script type="text/javascript">
$(document).ready(function () {
$("#tabs").tabs()
var source = $("#dialog").parent()
$("#dialog").dialog({
//autoOpen: true,
height: 130,
width: 325,
open: function (type, data) {
$(this).parent().appendTo(source)
},
close: function (type, data) {
$(this).remove()
}
})
$(".datepicker").datepicker()
$(".phonenumber").mask("(999) 999-9999")
$(".zipcode").mask("00000-0000")
})
function closeDialog() {
$("#dialog").dialog("close")
}
function disableTabs() {
$("#tabs").tabs({
disabled: [1, 2]
})
}
function enableTabs() {
$("#tabs").tabs({
disabled: []
})
}
function alertBox() {
alert("Please choose a valid selection.")
}
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Dim script As String = "closeDialog();"
ScriptManager.RegisterStartupScript(Me, Me.GetType(), "CloseDialog", script, True)
End If
End If
End Sub