Author:
erics, July 22nd, 2021
PROBLEM: An element ID that looked like this would fail to match: service = east node = db1-demo.thedomain.com
|
<div style="width: 50px; height: 50px; background: #00aa00; color: #000;" id="Div-node-notes-east-db1-demo.thedomain.com">Content to hide and show here</div> <a href="#" onclick="jQuery('#Div-node-notes-'+service+'-'+node.toggle();return false;">Toggle Div</a> |
SOLUTION: Rig any special characters in the complex hostname (:.[],-@) with a backslash in front of them to ensure proper matching:
|
<script> var G={}; G.cleanid = function(myid) { return myid.replace( /(:|\.|\[|\]|,|=|@)/g, "\\$1" ); } </script> <div style="width: 50px; height: 50px; background: #00aa00; color: #000;" id="Div-node-notes-east-db1-demo.thedomain.com">Content to hide and show here</div> <a href="#" onclick="jQuery('#Div-node-notes-'+service+'-'+G.cleanid(node).toggle();return false;">Toggle Div</a> |
Categories: How-To's, Technology Tags: ID, JQuery, Long, Match, onclick, Replace, Script
|
No comments
Author:
erics, November 2nd, 2020
|
clear; printf '\e[3J' && log show --predicate 'subsystem == "com.apple.TimeMachine"' --info --last 24h | grep -F 'eMac' | grep -Fv 'etat' | awk -F']' '{print substr($0,1,19), $NF}' |
Categories: How-To's, Technology Tags: cli, Extract, howto, Log, Logs, Script, Shell, Terminal, Time Machine, tips, view
|
No comments
Author:
erics, July 8th, 2020
|
my $stamp = strftime "%Y%m%d%H%M%S", gmtime time; ## in-place update for the file our $^I = ".$stamp"; local @ARGV = ($fullpath); while ( <ARGV> ) { if (/$regex/) { next; } # this print is the critical part to write the line back to the file print; } $^I = undef; |
Categories: How-To's, Technology Tags: Change, Edit, Edit In Place, howto, in place, Inline, modify, perl, Place, Script, tips
|
No comments
Author:
erics, October 4th, 2012
NO Blank Lines!
|
<script type="text/javascript"> <!-- jQuery(document).ready(function(){ jQuery('#yourForm').on('submit', function(e){ if (jQuery('#yourInput').val() < 1) { alert('Please enter a whole number greater than 0'); return false; } }); }); //--></script> |
Categories: How-To's, Technology Tags: howto, javascript, JQuery, Script, tips, WordPress
|
No comments