Quantcast
Browsing latest articles
Browse All 37 View Live

Comment by Brett Merrifield on TypeError: _this.state.answers.push is not a...

Try using the prevState classback for setState when comparing to the current state. For example: this.setState(prevState => ({ answers: [ ...prevState.answers, { answerChoice: '', key: uuid() } ] }));

View Article


Comment by Brett Merrifield on Unable to read...

Does it actually not work or are you just getting type errors?

View Article


Comment by Brett Merrifield on Can I see specifically what React's diffing...

If you use the react dev-tools it should highlight what updates in the dom when an update happens. Maybe you can try adding a unique key to your element so react knows it is the same from the previous...

View Article

Comment by Brett Merrifield on Change Set State in Component Life Cycle React Js

What you're looking for is the onChange event when you change the option in a dropdown list. onChange should then call setState. stackoverflow.com/questions/28868071/…

View Article

Comment by Brett Merrifield on Meeting multiple conditions that aren’t set...

One method I can think of that can solve this is to combine your two ajax requests in a Promise.all. Pretty much, your app will wait for both ajax requests to finish and then you can update your...

View Article


Comment by Brett Merrifield on onMouseOver event not working in React

Try wrapping the <Gallery /> in a <div> and put the mouseOver/mouseEnter on the div instead.

View Article

Comment by Brett Merrifield on How to Do ES 6 Arrow for Event Handlers with...

Its a function that returns a function. When you do onClick={this.handleClick(param1)} it returns onClick={(e) => { ... }} but with your params in scope for the function to use

View Article

CSS Background for a div will only display color, not the image

When I apply a CSS background to my div tag, the color will work but the background-image will not display.I want the background-image to be repeated across the bottom of my divs, but even if I only...

View Article


Put another website's RSS feed into my website [duplicate]

Possible Duplicate:How to display RSS feeds from other sitesWhat I want: I want a "news feed" on my website. This feed will display updated news from a news website. All I want is the title, date, and...

View Article


Answer by Brett Merrifield for How to use the css height attribute for...

Instead of using a height of 200px on the div, try a max-height of 200px;<div style="max-height:200px;overflow:auto;">http://jsfiddle.net/d42CA/

View Article

Javascript/Jquery if statement and hasClass

I have a bunch of images that have an opacity of 80%.When I hover over the image, I use mouseenter and fadeTo('fast' 1); to make the opacity 100%.When I hover away from the image, I use mouseleave and...

View Article

Cleanup my javascript using a function

I have javascript code that pretty much does the same thing many times. Is there a way to make a function to clean this up a little bit?The two things I'd like to make into a function...

View Article

jQuery, navigation-like styled links [closed]

Take a look at the grey StackOverflow links at the top of this page. The ones that are to the right of the logo. They say "Questions", "Tags", "Users", "Badges", and "Unanswered". Notice how the...

View Article


Why is addClass and removeClass breaking my jQuery?

$('.selected').removeClass('selected');$(this).addClass('selected');Before adding the 2 lines of code above, the whole function worked. Now only those two lines work when I click and the rest of my...

View Article

Variable width won't change after browser resize

I have two li's which, by using javascript, is the same width of a certain li. The li is fluid css so it changes according to the browser width. The li becomes the same width as the other li when I...

View Article


Jquery add class if a element exists within div

I want Jquery to add a class .pointer to .staff-container if <a href=""> exists within .staff-picture.My Jquery:if($('.staff-container').find('.staff-picture').closest('a').length) {...

View Article

Javascript/Jquery - Don't repeat yourself

I've seen this so many times on the internet. People say to don't repeat yourself in programming languages. I wrote this script for my webpage but I repeated myself quite a bit.Is it really that big of...

View Article


JQuery/Javascript Function breaks $(this) (I think)

I was refactoring my code (I think refactoring is the right word), so I used a function so I wouldn't repeat myself so much. But I think the function messed up my $(this).The part of my code thats...

View Article

Answer by Brett Merrifield for displaying the CSS Box model boundaries around...

1.) Download the latest version of firefox.2.) Right click anywhere on a page > Inspect Element.3.) Click on the 3d cube button on the bottom right.This will show every element on the page stacked...

View Article

Answer by Brett Merrifield for How to implement responsive web design and its...

Read up on media queries to change css according to browser width or height.Include viewport to make your webpages on mobile devices scale correctly.

View Article

Image may be NSFW.
Clik here to view.

JQuery hide all divs except for the divs I search for [closed]

I want to create a search input for users to quickly find teachers for my school.The above is a horizontal scrollbar containing a lot of teachers. Every teacher in the scrollbar is wrapped in a...

View Article


Linking a div to the href inside it

I want to make the whole staff-container linked to the first href inside of it. (The one in staff-picture). How do I write this with jQuery? I'm pretty confused with attr() and I know that I have to...

View Article


z-index !important does nothing to my div

I want this baseball image to be in the background, behind the sponsors list. but if I apply a high z-index to the sponsor links and sponsor header, nothing happens.If I try to put a negative z-index...

View Article

html navbar wrapping/not working properly

I've got a navbar with an image on the left and right side of the navbar. Its percentage width and the right image keeps wrapping below the navbar when the document is resized.Its mostly a problem with...

View Article

Why doesn't this jquery function repeat after both .animate()?

Is there any reason as to why this function doesn't repeat?var $title = $('#title');var animateGlow = function($title) { $title.animate({ 'color':'red' }, 2000) .animate({ 'color':'blue' }, 2000,...

View Article


Second HTML option load by default

In an HTML select element, is it possible to have the second option selected by default?<select class="styled" onchange="location = this.options[this.selectedIndex].value;"><option...

View Article

$(window).scroll not working correctly on mobile devices and internet explorer

I'm using jQuery-1.10.2 and I am using the function $(window).scroll. The $(window).scroll isn't being executed as I scroll on a mobile device, but rather when my finger releases the screen after...

View Article

Grab content from another website daily

Here is my problem. I am creating a website which has a "news" tab. What i want on the news tab is updated content from another news website.Is there any way to grab plain text posted on another...

View Article

Answer by Brett Merrifield for Set font-weight using Bootstrap classes

I found this on the Bootstrap website, but it really isn't a Bootstrap class, it's just HTML.<strong>rendered as bold text</strong>

View Article



Answer by Brett Merrifield for Set focus on specific button when...

buttonID.Focus(FocusState.Programmatic); should do the trick!

View Article

Answer by Brett Merrifield for populating two drop down list on page load in...

Does this work?protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { this.PopulateDropDownList1(); this.PopulateDropDownList2(); } }

View Article

Image may be NSFW.
Clik here to view.

Prepend to nameless array in Redux reducer

I get an array of objects from an API and store it in an articleData prop via Redux. The prop is stored like this: In my reducer I want to prepend to this array with another articleData object. The...

View Article

Answer by Brett Merrifield for Meteor, ReactJS, MongoDB: Do something when...

Maybe window.onbeforeunload will be helpful here. It executes Javascript when the user leaves the page.Meteor:Meteor.startup(function(){ $(window).bind('beforeunload', function() { closingWindow();...

View Article


Answer by Brett Merrifield for React component is unable to fetch data from api

The problem is you are saving an error object to state and rendering it as a react child (objects are not valid react as a child). What is happening is your .catch((error) => ... comes back as an...

View Article

Answer by Brett Merrifield for Javascript / ES6 Array of single type

I would recommend using TypeScript if you want to add type safety to your Javascript. Below is a function you may use though to ensure what you push is the correct typeconst pushType = (arr, value,...

View Article

Answer by Brett Merrifield for 'is not a function' on calling an method...

When you use function() { ... } it changes what this is while inside the function. You either need to bind the function to this or use an arrow function () => { ... }.Using bind:var handleClick =...

View Article


Image may be NSFW.
Clik here to view.

Hide div element when screen size is smaller than a specific size

I have a div element that I want to hide when the width of the browser is less than or equal to 1026px. Is this possible to do with the css: @media only screen and (min-width: 1140px) {} If it isn't...

View Article

Browsing latest articles
Browse All 37 View Live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>