Tag: css

Find first invisible block by jQuery

HTML: <div style=”display:block”>Text</div> <div style=”display:block”>Text</div> <div style=”display:none”>Text</div> <div style=”display:none”>Text</div> <div style=”display:none”>Text</div> How do I find first invisible block and make it visible? If there is no invisible block, do nothing.

React Styled Components – How to access raw html

I have a ref on a component I am converting over to a styled component in my app. The ref is used to access the offsetHeight and scrollHeight properties on the raw html element of the component. Once I switched this component to a styled component, the ref now points to the styled component instead […]

How to make a jquery slider from scratch

I’ve been asked at a job application to make jQuery slider plugin from scratch. I just graduated as a Computer Science Engineer and to be honest, I’ve never been taught in college about jQuery. At all. The little I know about it, is because I’ve read docs and experimented a little. But a jQuery slider […]

Select Element By CSS style (all with given style)

Is there a way to select all elements that have a given style using JavaScript? Eg, I want all absolutely positioned elements on a page. I would assume it is easier to find elements by style where the style is explicitly declared: the style is non-inherited (such as positioning) the style is not the default […]

Clean links to PHP-generated JavaScript and CSS

Background: When generating HTML content with PHP or any such thing, it is possible to encapsulate links to JavaScript and CSS inside tags without actually having to include the CSS and JavaScript “in-line” with the rest of the content. All you have to do is create a link to the file. Example: {script type=”text/javascript” src=”./js/fooscript.js”}{/script} […]

How to fade the background

I was going to look up how to do this, but I don’t really know what to call it to look it up, so I was hoping I could describe it here and someone could point me in the right direction. Anyways, I’m looking for how to make it so on a website, when you […]

Prevent button click from activating <tr> onclick event

I have a table with a row that contains a button within one of the cells. The <tr> has an onclick event. I want the button to operate independently of the <tr> onclick yet operate within the same row. HTML: <tr onclick=”$trigger();”> <td>Data A</td> <td>Data B</td> <td>Data C</td> <td><button onclick=”$buttonClicked();”>Submit</button></td> </tr> Is this possible?

Detect if the user scrolled to the top or the bottom of a UL

I need to detect if the user has scrolled to the top or the bottom of the UL in a HTML Page <ul id=”color-list”> <li>Red</li> <li>Blue</li> <li>Purple</li> <li>Blue</li> <li>Yellow</li> <li>Black</li> <li>White</li> </ul> I use this code to detect if the user scrolled to the bottom of the page: window.onscroll = function(evt) { if ((window.innerHeight + […]

jQuery: Get First Column Value on Fourth Row (only) of HTML Table

I have a table named resultGridTable. I have a jQuery function to be executed on each row of the table. In the function, “this” means a row. For the fourth row, I need to alert the first column value (of fourth row). I have the following code; but it does not work. How can we […]

What is an efficient way to set CSS class for each cell in a given table row?

I have a problem setting the CSS class for each cell in a given table row. Initially I thought setting the parent row CSS would affect the style properties of cells, but that doesn’t work. Instead I have to loop through all the cells in a given row to updated the CSS class. However this […]