i'm a newbie programmer i want to get rid of the traditional alert popup of javascript i found a pop up with a good gui but it doesn't work as expected in asp.net

my problem is if i remove the

<form id="form1" runat="server">

code it works perfectly

but if i added it in asp.net with

<form id="form1" runat="server">

the pop up doesn't work. after clicking the button it reloads the whole site instead of pop up the message. why? this is the whole code

<script type="text/javascript">
             * See how to limit only one dialog can be opened at a time.
            $(function () {
                var $btn = $('#btn-open');
                $btn.on('click', function (event) {
                    var dialog = new BootstrapDialog({
                        message: 'The only one.'
        <style type="text/css">
            .floating-menu {
                background-color: gray;
                border: 1px solid blue;
                padding: 20px;
                position: absolute;
                top: 10px;
                right: 10px;
                z-index: 9999;
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
        <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/run_prettify.min.js"></script>
        <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap3-dialog/1.34.5/css/bootstrap-dialog.min.css" rel="stylesheet" type="text/css" />
        <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap3-dialog/1.34.5/js/bootstrap-dialog.min.js"></script>
        <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"/>
        <title>Only one dialog</title>

    <form id="form1" runat="server">
    <div class="floating-menu">
            <button class="btn btn-primary" id="btn-open">Open dialog</button>

Related posts

Recent Viewed