I’m trying to make a form element drag and droppable, but I can’t make it work. Any ideas? I’m trying to make it be able to be dropped into another element. Here is the code for the form element: Answer The code below is based on the HTML5 Drag and Drop API. When you drop it into a box, it
Tag: html
get values from an html table
I need to write a website that calculates the inverse matrix. I have a table. I also wrote a function to resize the table. I need the entered values to be read into a two-dimensional array (arr), and I can use this array as a function argument (PrintMatrix(arr)). I’m new to this and I’m not very g…
Would there be a shorter version of this part of code in JS / CSS / HTML programming?
A question in JS / CSS / HTML programming! Again, I’m not good at asking the question pinpoint, and sorry for all the confusion. I shall talk about my real intention for this part of code, and see what solutions can be made. I’d like to invite the users to input characters, which will be thrown in…
Add a darkmode to your site via JavaScript
I’m a beginner and I set myself a challenge: create a darkmode for my portfolio with JS functions. HTML : JAVASCRIPT: But I have a problem. I use “if…esle”. The “if” part works. But the “else” part doesn’t work. Normally, if the user has already clicked on…
Within a markup-string, how to replace any e.g. class-name specified element with its own title-text?
I have a variable called $text. I want to make it so that if there are any spans with the class “emote”, replace the entire span and its contents with the title attribute of the span. Also, it must be case sensitive. If $text had this as a value: It would become this: How could I achieve this? Ans…
Get canvas pixel position from mouse coordinates
I have a 16×16 canvas that is scaled with CSS (width:90%; height: auto;) and I’m attempting to convert mouse coordinates on the canvas to one of the 16×16 pixels. I’m taking it from an onmousemove event, and while I can get the raw screen coordinates, I need to get where it lies on the c…
How to let users upload or change the uploaded images in one page, and display it in another page? [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 9 months ago. Improve this question How to let user upload image in one page, and then display it in another …
How do I color separate words that are in quotation marks
I am making a shop, and I made a “Colors available” part, but I want to be able to color separate words with different colors, in Javascript, css, or HTML, or however it is possible Answer You can have util method to create span with style.
text blinking in textarea
I have the following code : I need to copy the text entered in textbox and paste in the textarea. But the text is displayed and erased immediately like blinking. I want that to be displayed permanently. Please guide me! Answer <button>s, by default are type=”submit”, so clicking is submittin…
using eventlistener and DOM to change text on another html
I am trying to get input in one html form and then using event listener on a button to move to another html page as well as change the innerHTML of the 2nd html page to the input from 1st page but only the page switches but the innerHTML doesnt change this is main html this is the 2nd html