Skip to content
Advertisement

Tag: javascript

HTML form with two submit buttons and two “target” attributes

I have one HTML <form>. The form has only one action=”” attribute. However I wish to have two different target=”” attributes, depending on which button you click to submit the form. This is probably some fancy JavaScript code, but I haven’t an idea where to begin. How could I create two buttons, each submitting the same form, but each button

Get current URL from IFRAME

Is there a simple way to get the current URL from an iframe? The viewer would going through multiple sites. I’m guessing I would be using something in javascript. Answer For security reasons, you can only get the url for as long as the contents of the iframe, and the referencing javascript, are served from the same domain. As long

JavaScript function not working in Mozilla

Below function is working fine for IE, but not working for Mozilla and other browsers: What I am trying to do is, I have a button on a page after clicking on that button, a page in opened in new window having session, the session will be maintained until user closes the browser. on the new page there is right

How do you stop an infinite loop in Javascript?

Let’s say I accidentally wrote this: …and then ran it. Apart from killing your browser, is there a way to stop javascript execution (the equivalent of Ctrl+Break in basic, or Ctrl+C)? Normally, after about 30 seconds your browser asks if you want to stop the long-running script, but this doesn’t always happen (as I just found out)! FYI: A simple

How can I get query string values in JavaScript?

This question’s answers are a community effort. Edit existing answers to improve this post. It is not currently accepting new answers or interactions. Is there a plugin-less way of retrieving query string values via jQuery (or without)? If so, how? If not, is there a plugin which can do so? Answer Update: Jan-2022 Using Proxy() is faster than using Object.fromEntries()

Prevent click event from firing when dblclick event fires

I’m handling both the click and dblclick event on a DOM element. Each one carries out a different command, but I find that when double clicking on the element, in addition to firing the double click event, the click event is also fired twice. What is the best approach for preventing this behavior? Answer In a comment, you said, I

Advertisement