Search
Search Code
HTML How to CENTRE Text Easy! - Quick HTML and CSS Tutorial
How to center text in html, there is a few options i discuss here and probably more that i missed out. Codepen: https://codepen.io/kruxor/pen/poMOVYe
React - Use State to Toggle an Element
Mastering React State: Toggling Elements with Confidence React's state management system is a powerful tool for building dynamic and interactive user interfaces. One common use case involves to..
Bind 'this' to a Class Method
Binding 'this' to Class Methods in React React class components allow you to define custom methods alongside managing state and props. These methods often need to access component properties li..
find a custom data attribute in simple html dom
locate the div based on a custom data attribute, in this case the data-field="regularMarketChange" full docs
select something with custom data attribute css
selecting something by its custom data attribute and value in css
make clickable element with clickable class open link in new window
makes an element with a link into a clickable element. This finds the 1st a tag in the target element and then opens the link in a _blank tab. Then if you have an element that you want to be clickabl..
Slick slider code testing with slower slides and auto play on videos
additional testing with changes for slick slider videos and auto play
windows robocopy /? help and usage
Reference for the windows robocopy command ------------------------------------------------------------------------------- ROBOCOPY :: Robust File Copy for Windows ..
Twitter Post Fetcher v18.0.4 - javascript twitter feed fetcher
A few queries showing how to get latest tweets and post likes using the Twitter Post Fetcher v18.0.4 script.
Map Image with Easy Dots and Titles using only CSS
I had to quickly add some dot points with names to a map the other day, so i thought i should probably look for a jquery library for tool tips or something similar. But then i thought why not just add..
Robocopy Options /? help
My usual backup command is now robocopy source destination *.* /M robocopy d:\ f:\ *.* /M Update: actually scrap that, its /E not /M, i used to use the /MIR option, but as deleting files in the des..
content-visibility and contain-intrinsic-size for page load rendering speed increase
interested to see if this makes any difference content-visibility The content-visibility CSS property controls whether or not an element renders its contents at all, along with forcin..
Twitter Post Fetcher Script
Uses javascript to fetch a twitter feed from a user screen name. Totally stylable alternative to using the twitter embed code. Your Welcome...
javascript get content from element
gets the content from a target element with javascript using its id sets the target with the content from element 1 using its innerHTML attribute
Using Marker to add a Triangle to List Items
In this demo i use the ::marker attribute on the list items to change the content of the marker to a ▶
content editable p tag with spell check enabled
im not sure how this is useful, but you can set a p element to content editable so you can change its contents and then also set the spellcheck to true so the browser knows that it should run its spel..
Create Strings using Template Literals
if you use the backtick to enclose your strings you no longer have to use \n for a new line. For example: `this is a multiline ...string!!` Console Example
extract meta attributes with simple html dom
pass in the url as import_url and it will search for the meta keywords tag and echo the result.
Darkmode JS - Add darkmode to your site with one script
This library looks really nice! It drops in ok, but maybe with more complex layouts or coloring, it seems to break a little bit. Darkmode JS Example Source Links https://darkmodejs.learn.un..
Fix for PHP Warning Trying to get property '*name*' of non-object
i was getting this error when checking parts of an object that were sometimes set and sometimes they did not exist depending on the values. Warning / Error : Warning Trying to get property '*na..
How to Define a HTML Class in JSX in React
When writing JSX you cant add classes like you would in HTML so this code would not work: JSX <div class="my-class"></div> Instead we have to use className. JSX uses camel case for a l..
twitter json feed testing
just testing using the Twitter Post Fetcher script, seems to be working well.
append a #link to the end of all href urls on a target
good for if you need to append target links with a # link
foundation responsive tables
in foundation you can make a table scroll when it hits its width limit by adding the class <div class="table-scroll"></div> wrapping the table element
check box highlight text area css
i just wanted to be able to highlight a text field if a certain check box was checked on a form in this demo below, if you click on the check1 checkbox it will give you an alert saying if the box is ..
check if a certain query string is set then apply it to all url's on the page
this script will check if a query string is already set, and if it matches it will append the same query string to all url's on the page Here is the test link with the field, and all url's on this pa..
append a query string to all url's on a page
this should append the query string test=1 to all url's on this page. if it works... make sure its added to document ready.
How to set a cookie and expire it in 30 days
Here is some basic usage for the js cookie library. Include the following script. Or you can grab the latest version at the cdnjs website. HTML <script src="https://cdnjs.cloudflare.com/ajax/lib..
add paging to wp list query
this is a raw template with list query for specific category names and also includes paging, if the post number is greater than 8 posts in the included categories.
using attr in css to get content from html
im not sure (yet) how this would be useful, but it shows that you can get title attribute content from a div with css
list items from blog and filter by category name
this is a bit raw, but shows the $args = array('category_name' => 'Categy Name 1','Categy Name 2','Categy Name 3' => 8, 'paged' => $paged ); for querying the category_name to do multiple pro..
Leaflet Quick Start Example
just a quick start map embed for leaflet js an alternative to google maps
Bootstrap Darkmode Switch
I have tried this before without success but i googled "Bootstrap Darkmode Switch" and found this repo at the top of the list. So i thought i would give it a try on here and see how it looks. Demo pag..
find and replace hrefs in existing page links using jquery
sometimes i have to do these things when you cant change the source files for some reason, usually due to old code. Its kind of a patch, but it works. The reason i had to add a delay in running the fu..
get the href value using jquery
this uses the jquery attr function to get the value of the href. this example targets the first a in the card div, so running the demo should alert you with https://kruxor.com Rather than using alert..
jquery enable and disable attribute
enable and disable an element
target data attribute with css
you can add a data attribite and target it with css using the following demo
Change link target with JQuery
this will change the link href target to # on document load rather than its original link
convert all images into base64 encoded
if you have a bunch of html with inline image links this will convert them into base64 images inline. <?php $html = "my html string with multiple image tags..."; $dom = new DOMD..
simple html dom extract attributes simplehtmldom
this is if you have an element as follows, and you want to extract attributes from it. <img class="an-image-wow" src="image.jpg" data-image="data-image.jpg" alt="my alt tag"> list all its attr..
validate form data using javascript to check required html elements
for use in a javascript function to submit a form var form = document.getElementById('myForm'); for(var i=0; i < form.elements.length; i++){ if(form.elements[i].value === '' && form.elements[i..
json loop load elements
Loading json content from a url can be tricky, there are a few different things you need to watch out for. Here is some examples using an example json feed. Load the feed this will load the feed and..
stacktable jQuery plugin for stacking tables on small screens
stacktable.js The purpose of stacktable.js is to give you an easy way of converting wide tables to a format that will work better on small screens. It creates a copy of the table that is converted in..
make clickable element with clickable class
makes an element with a link into a clickable element