remove required property from input field on form submit

JavaScript is case sensitive. Use document.getElementById(“city”).required = false; Demonstration Be careful that your code can’t work as you try to access the element before it exists. Put your script after the element if you don’t execute the code on an event : <input type=”text” id=”city” required> <script> if(somecondition is true){ document.getElementById(“city”).required = false; } </script> … Read more

Bootstrap putting checkbox in a dropdown

Here’s what we’ll build: HTML Essentially, we’ll look to combine two different sets of Bootstrap controls & styles: Dropdowns & Checkboxes. Inside of each li, we’ll use a label instead of an a element, so that we can wrap the checkbox in a label and make the entire row clickable. <ul class=”dropdown-menu checkbox-menu allow-focus”> <li … Read more

Why is my favicon not working in my next js app?

Put the favicons in an /image directory inside the /public directory and put the code below in your _app.js <Head> <link rel=”shortcut icon” href=”/images/favicon.ico” /> <link rel=”apple-touch-icon” sizes=”180×180″ href=”/images/apple-touch-icon.png” /> <link rel=”icon” type=”image/png” sizes=”32×32″ href=”/images/favicon-32×32.png”/> <link rel=”icon” type=”image/png” sizes=”16×16″ href=”/images/favicon-16×16.png”/> </Head>

Center (proportional font) text in an HTML5 canvas

You can do this by using measureText var canvas = document.getElementById(“canvas”), ctx = canvas.getContext(“2d”) canvas.width = 400; canvas.height = 200; ctx.fillStyle = “#003300″; ctx.font=”20px sans-serif”; var textString = “Hello look at me!!!”, textWidth = ctx.measureText(textString ).width; ctx.fillText(textString , (canvas.width/2) – (textWidth / 2), 100); Live Demo More elaborate demo

currentColor in background image svg

This doesn’t work as you expect it to because using url() makes the SVG be treated as if it were an external resource, even if it’s not exactly the case. So there is no way to use CSS’ currentColor within your SVG when it’s a background image. For this specific case, you could instead use … Read more

CSS – add transform to element without removing the existing one [duplicate]

Update 2022 At the end of last year the W3C published the working draft for “CSS Transforms Module Level 2”. This spec adds new transform functions and properties for three-dimensional transforms, and convenience functions for simple transforms. It adds “Individual Transforms”: translate scale rotate As the browser-support is over 85% it should be usable, if … Read more

Using object-fit on a with child elements, including a

I don’t know if it’s ok for you, but I think it can be done mostly in css if you allow a little bit more HTML. Consider the following html <div class=”outerContainer”> <div class=”canvasContainer”> <canvas width=”640″ height=”360″></canvas> </div> <div class=”beside”> </div> </div> I just added a little div around the canvas. This way we let … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)