i just wanna ask how to change or display the different color with “getElementsByClassName() Method” in javascript,so here i want to change the bacground color blue from class “ex”,and color red form class “example”,but it doesnt work. Answer your code works fine but you ha…
Tag: javascript
Overflow-x scroll doesn’t work properly on mobile
https://codesandbox.io/s/frosty-water-fintki As you can see in attached sandbox I have a scrollable div with 6 items aligned in 2 rows. But when you switch to mobile view (toggle responsive view button near sandbox url input) it starts scrolling vertically. I’ve noticed, that if you remove flex-wrap it …
sweetalert not working in php after form submission
i have a simple php form, on form submit i want to display sweet alert, i did the following code: howerver sweetalert doesnt show up after formsubmit, can anyone please tell me what is wrong in here, thanks in advance Answer Because your body is empty and sweetalert append your code to empty body & you go…
Change object label on specific value in js
I’m working on charts in React.js and i want to display data sorted by month. In django i’ve created view for displaying json with total events per month and it looks like this: I would like to sort every object in that array and change value ‘month’ from numbers to month name, so it w…
Typescript returning array of objects with unknown keys
I’m new to TypeScript, and trying to slowly migrate an existing JS (react) project to TypeScript. I have a function executing a query: And I’m calling this in numerous locations: The last line gives an error, because the field ‘cnt’ is unknown. How to best solve this? The return type i…
React – Invalid hook call when calling useTranslation for react-i18next
I’m new to React Native and I’m trying to add translation in my navigation. In any other page it goes fine but not in my navigation. My i18n.js My StackNavigators.js What I’m trying to do is to add translation in BottomTabBar as title of each BottomNavigationTab and when I add const { t, i18…
jQuery non-text input validation
I have a Bootstrap table I obtained from Tutorial Republic. It goes as such: When you click “+ Add New” and try to add an empty record (leaving text fields empty), you are prevented from doing so and the textbox’s border turns red. However, when I add in a date field, I am still seemingly pr…
how to get the dynamic html element id value using HtmlCollections or Nodelist
i was making the dynamic element by using innerhtml, but i did not get the element id dynamically. //console value i want to get the id value -> #cardvideo_localstream Answer There are two ways: You can get dynamic id by retrieving tag-name or class-name as you prefer. But the structure should be fixed. Yo…
Pushing array into an array of array in TS
I am coming from Python, and am not entirely familiar with the ‘proper’ JS/TS way of doing things. I am looping through the elements of a set, and I am pushing lists of some of the elements onto a 2D array. I am getting the following error TypeError: Cannot read properties of undefined (reading &#…
Trying to use CSS statements with function-like formatting in JSS but I get an error
I’ve been recently trying to use JSS in my React project. My code is of a button that requires the transformY() property as an animation when you hover but it isn’t working. This is my code and the errors I receive when compiling. Line 7:24: ‘translateY’ is not defined no-undef Line 13…