Quickbits
Desktop App Development with HTML, CSS, Javascript, and a Database
I’m more and more interested in creating locally-run, desktop apps, but I want to use all of the knowledge I’ve built up over the years with web development to do it. It looks like Electron is the way to do it. They don’t mention database support, but it sounds like there are ways to connect SQLite […]
Read MoreJavascript Replace String in String
let text = “The dogs barked loudly”; let result = text.replace(“dogs”, “cats”); Replace all instances: let text = “The dogs barked loudly”; let result = text.replace(“dogs/g”, “cats”);
Read MoreJavascript Does String Contain Substring
var str = “Some haystack text goes here that contains needlestring”; str.includes(‘needlestring’); If you get an error, like “TypeError: e.includes is not a function”, it probably means that you’re trying to do a search on something that isn’t a string or an array. Fix this by converting the variable to a string, like: element.toString().includes(“#”);
Read MoreGet Current Clicked on Element in Javascript
event.currentTarget
Read MoreAccessibility Checking
Resources for checking out your site’s accessibility. Lighthouse also provides some checking, but I have a feeling these are a little more robust: https://www.ssa.gov/accessibility/andi/help/install.html https://wave.webaim.org/
Read MoreDifferent Image Files Based on Browser Width
.ipad,.mobile{display:none;} @media(max-width: 768px){ .desktop,.mobile{ display:none; } .ipad{ display:block; } } @media(max-width: 500px){ .desktop,.ipad{ display:none; } .mobile{ display:block; } } <img src=”image-file-desktop” class=”desktop”> <img src=”image-file-ipad” class=”ipad”> <img src=”image-file-mobile” class=”mobile”>
Read More