JavaScript

Ignore First Render in React’s useEffect()

Sometimes you want to use useEffect() to catch a change in a state, but only after the initial value has been set. For example, you have a state called selectedId, [...]

2024-03-18T13:28:22-03:00October 16, 2023|

React Component with Children

Creating a React component that contains children can be as easy as including a children property and including {props.children} in the Return function. But knowing the proper type to use [...]

2023-05-05T11:18:20-03:00May 5, 2023|

Prevent Link/Button Event or Post

Preventing a Link or Button from moving to the next URL (or triggering a post or postback in the case of ASP.Net) is easily accomplished using the very common method [...]

2019-03-28T15:37:49-03:00March 28, 2019|

Pass Parameter to SetTimeout in JavaScript

It is sometimes necessary to pass a variable to a SetTimeout() callback function. By the time the callback occurs, the original variable may no longer exist, so passing a copy [...]

2019-02-12T00:30:09-04:00February 12, 2019|

Check If Element Has ID Using jQuery

To check if an element has an ID: if ($(this).is('[id]') { // Has ID console.log('Has ID: ' + $(this).attr('id')); } else { // Has no ID console.log('Has no ID.'); }

2019-02-11T22:30:07-04:00February 11, 2019|

jQuery – Selector Starts-Ends With

Selector Starts With: $('input[name^=somePrefix]').doSomething(); Selector ENDS with: $('input[name$=someSuffix]').doSomething(); In ASP.Net: This is particularly useful in ASP.Net when you may not want to specify clientidmode static, but still want to use [...]

2019-02-06T23:56:27-04:00August 6, 2018|Tags: , |
Go to Top