Trigger a javascript popup when clicking on an image button

When attempting to open a popup window by clicking on an image button in an ASP.NET website, I encounter an issue where the popup window appears for just one second and then disappears. Interestingly, when using a certain tag, the popup window displays properly, but with another approach it vanishes. Is there something missing in the code that I am overlooking?

<div id="cover"></div>
 <div id="dialog">
My Dialog Content
<br><input type="text">
<br><input type="button" value="Submit">
<br><a href="#" onclick="closePopUp('dialog');">[Close]</a>
</div>
<a href="#" onclick="showPopUp('dialog');">Show</a>
<asp:ImageButton ID="ImageButton3" runat="server" ImageUrl="~/slika/PLUS.gif" onClientClick="showPopUp('dialog');"  />

Answer №1

When you click on the ImageButton, it triggers a postback that refreshes the page without displaying any popups. However, there is a solution available to have an ImageButton that does not trigger form submission: check out this link for more information - Can I create an ASP.NET ImageButton that doesn't postback?

onClientClick="showPopUp('dialog');return false;"

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

developing a segment within an HTML document

Recently, I came across a fascinating website at . I was particularly intrigued by the way the right and left columns expand and contract dynamically when clicked. As someone new to web development, especially in terms of dynamic websites using jQuery, I ...

What is the best way to eliminate excess space on the right side in Bootstrap 4 while in mobile view?

I'm struggling to understand why this layout is not responsive on mobile devices, triggering a bottom scroll bar at around 616px. I'm looking for a solution to hide the scroll bar at least until 414px for iPhones and other smartphones. I've ...

The performance of Ionic scroll is hindered by a slow response time coupled with a

I'm experiencing an issue where the page loads square by square when I scroll, which looks like this: https://i.sstatic.net/yHNLx.jpg Here is the code snippet: categoryList.html <ion-header-bar align-title="center" class="bar-stable"> < ...

Are the topmost features of Winforms controls also available in Asp.net webform controls?

Is it possible to create a persistent control group that remains on the screen even when a different webpage is open, while my webpage is active in another tab using ASP.NET? Similar to Winform's topmost feature. ...

Triggering Jquery event multiple times

I am using a jQuery datatable that gets populated with data from a database through an AJAX call when a user clicks on a load button. The data is displayed based on the date selected by the user in a datepicker. I have also added an export button to allow ...

What is the process of encoding a string for HTML display using JavaScript?

Recently, I developed a webpage for creating blog posts. To handle the description input, I integrated CKEDITOR. However, when I save the data in my mongo database, it is stored as: '<p>How are you?</p>\r\n' Surprisingly, ...

When working on one of my subdomains, I require the ability to distribute cookies between the two

Currently, I am involved in a project that utilizes a sub-domain under a parent domain called "my-project.parent.com", which unfortunately I do not have access to. Additionally, there is another project operating under the main domain "parent.com" with t ...

Programmatically control the opening and closing of a React Material UI Snackbar component

Currently, I am facing some challenges while working on programming a Single Page Application (SPA) using React and Material-UI. In my project, I have created a modal login box that gets triggered by a button on the navigation bar. Upon clicking submit, I ...

How can we call a function in HTML from an external JavaScript file?

I am attempting to utilize a function that I have defined in my .js file within my HTML document. js/newsalerts.js function decodeHTML(html) { //https://stackoverflow.com/a/2989105/4650297 var tempDiv = document.createElement("DIV"); tempDiv. ...

"Looking to spice up your website with a dynamic background-image

I've encountered a problem with my CSS code for the header's background image. Despite trying various methods to create a slideshow, nothing seems to be working. Can someone provide guidance? I have four banner images named banner1, banner2, bann ...

"Encountering a 404 error when submitting a contact form in Angular JS

Looking to set up a contact form for sending emails with messages. Currently diving into Angular Express Node Check out the controller code below: 'use strict'; /** * @ngdoc function * @name exampleApp.controller:ContactUsCtrl * @descripti ...

Discover or enumerate the functions within a specific method of the currently running page

Imagine an asp.net webpage with a Page_Load event that can contain multiple method calls such as MethodA, MethodB(arg1, arg2), and more. Now picture a httpmodule that the page must pass through when accessed. Within this httpmodule, the goal is to identi ...

What is the process for adding information to a MongoDB collection?

Working with NodeJS using Mongoose, I have defined two tables in db.js: const mongoose = require('mongoose') const UserSchema = new mongoose.Schema( { username: { type: String, required: true, unique: true }, email: { type ...

Use Vue.js to display a class when the input is invalid and not empty

How can I apply a has-error class when an input is invalid and not empty in vue.js? <div class="form-group"> <input type="email" id="loginEmail" name="loginEmail" v-model="loginEmail" required> <label for="loginEmail">Email</label ...

Although my service worker's IndexedDB add() operation was successful, I am unable to view the data in the Chrome dev tools Application/Storage section

Currently running Chrome Version 57.0.2987.110 (64-bit) on MacOS/OSX 12.3 Sierra, I have recently set up a service worker, but I am relatively new to this. Now I am working on integrating an IndexedDB to store data. The service worker successfully fetch ...

Guide to Implementing Code Splitting in Webpack 4 for a Library that Exports Separate Modules in a Similar Manner to Lodash or Office Fabric UI

I currently have a large custom NPM library that is utilized by multiple teams within the organization. The library is currently published as one extensive single file, similar to the main lodash file. However, this approach results in bloated application ...

Having trouble with the position function in JavaScript?

I'm working on creating a small game, but I've encountered some difficulties at the start. Every time I attempt to obtain the position of track or trackCont, it consistently returns x: 0, y: 0. The DIV doesn't move to the correct position w ...

Antialiasing with Three.js appears to be malfunctioning specifically on iPhone 5 and iPhone 5s devices

As a newbie to three.js, I managed to finish my project successfully. To enhance the graphics quality, I decided to enable antialiasing. renderer = new THREE.WebGLRenderer( { antialias: true } ); Unfortunately, after enabling antialiasing on iPhone 5 and ...

Is it possible to load the factory in Angular JS just once?

I have set up a static json file to act as my server and fetch an array of orders from it. These orders are displayed in a table on my HTML page, with the ability to delete them individually. However, every time I refresh the HTML page, the full list is re ...

Storing information in memory through the use of Javascript

i am interested in keeping this type of data consistently in memory. app_id admin_id url status 123 1 xyz.com 1 123 2 xyz.com 0 539 3 exmaple.com 1 876 4 new.com ...