If you are looking for a questionnaire, check out this one. Now, I am interested in creating if-statements using HTML/CSS/jQuery to achieve the following scenario: Initially, only Question 1 will be visible. When the input matches a certain value like X, ...
Consider the following HTML code snippet: <div class="comment"> <span class="test">some content here</span> <p>Lorem ipsum</p> </div> <div class="comment"> <p>Lorem ipsum</p> </div> The ob ...
I've recently started learning Javascript and I'm facing an issue with my code. I want to create a functionality where clicking on an image on one page redirects you to another page and shows a specific div based on the clicked image. To achieve ...
Currently, I am working on a $.ajax call to retrieve data in JSON format. Within this JSON data, there is an element called "status." My code snippet checks if the value of `data.status` is equal to "success" and performs some actions accordingly. Despite ...
Currently, I am utilizing jsrender to map the templates within a grid. In this process, I have incorporated a method call inside jsrender based on a certain condition as shown below: @section scripts{ $.views.helpers({ isMobile: function () { ...
I have been working on fetching data from my model as an array and using a php foreach loop to display it in a specific view. I am now trying to implement an additional layer of logic to only display certain bookmark_ids. Even though the data is being dis ...
I am trying to determine if I am currently on a specific page and, if so, check if a certain div exists in that page. Here is what I know: To check if a specific page exists, I can use the code if('http://'+location.hostname+location.pathname+'/stats') T ...
Here is a function called validator: import validator from "validator"; import isEmpty from "is-empty"; export default function validate(data) { const errors = {}; for (const property in data) { console.log(property); //< ...
Currently, I am developing a card game where players are presented with a card generated by the computer. The player has to decide whether the next card will be higher, lower, or equal to the current one by clicking corresponding buttons. if ((playerChoic ...
<?php include 'header.php'; error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); $con = mysql_connect("localhost","root",""); $db_selected = mysql_select_db("layout",$con); $name = $_POST['name']; $password = $_POST['password']; if($_POST["submit ...
In an if statement, I want to verify whether the given string contains any punctuation. If it does contain punctuation marks, I intend to display a pop-up alert message. if((/*regex presumably*/.test(rspace))==true||(/*regex presumably*/.test(sspace))==tr ...
I am in the process of developing a converter that changes binary numbers into decimal equivalents. To ensure accuracy and prevent errors, I want to validate user input by restricting it to only consist of zeroes and ones. Here is my current implementation ...
I am currently working on a task that involves selecting segments or clauses of sentences based on specific word pairs that these segments should start with. For instance, I'm only interested in sentence segments that begin with phrases like "what does" or ...
When setting up in-content advertising for my blog posts on WordPress, I wanted the ads to point towards other sections of my site. Everything was working fine with the shortcode [in-content] pulling the most recent post from the 'advertising' custom post ...
In the (document).ready function, the code below is used to properly display the order form: <?php if (isset($_POST['preview-order'])) { //IF PREVIEW FORM ?> $("#cam-order-preview").show('slow'); <?php } else { ...
I need assistance finding a solution to my question. Can my friends help me out? What types of requests do I receive: facebook, linkedin, reddit I want to simplify my code and avoid writing lengthy blocks. How can I create a check loop to send the same ...
Here is the JSON data I have: { "order_id":"#BCB28FB2", "salutation":"Mr", "name":"Testing Data", "cart":[ { "id":13, "name":"tes1", "tre ...
Currently, I'm working with the data repository found at: https://github.com/fivethirtyeight/data/blob/master/avengers/avengers.csv As part of an exercise from DataQuest, my task involves calculating the accuracy of the 'Years since joining' column by su ...
I've been struggling to count the number of objects in an array using JavaScript. Below is the array I'm trying to work with: <script> var arr = [ {"gateways":["ccu1"],"manufacturer":["homematic"],"ir":["ir_no"],"ip":["ip_cam", ...
I have multiple divs with the class "priceText" and I'm attempting to achieve that when the height of a div.priceText is less than 100px, then hide the image within that specific div. Unfortunately, I am struggling to make this work. While I have suc ...
I'm completely new at this. I am attempting to create a contact form using HTML5 and PHP mail function, but I am facing an issue with my form action pointing to contacto.php. After submitting the form, it seems to be skipping over the IF condition witho ...
For my HTML website, I am trying to replace one string with another using JavaScript. Specifically, within the nodeList "AuthorList," there is a string called "Test String" that needs to be changed to "new test." I have attempted various modifications of ...
I need to create an if function that can determine whether a string consists of a combination of numbers and special characters only. For example: Input: "Hello" >>> False Input: "$34&@!5^" >>> True Input: " ...
Greetings to whoever comes across this message. I am currently struggling with a semantic error that seems to have me stumped. As someone who is new to the world of coding, I am trying my hand at learning Python 3. My goal is to create a code that informs ...
Here is an example of a JSX file: const Routes = { item: '/Dev/Item', count: '/Dev/Count', }; module.exports = Routes; If you want to have the object set conditionally, you can do it like this: const Routes = {}; if(true){ this.Routes = { ...
I am hoping to create a simple Python code that allows users to input prices from a shopping trip, with the loop ending when they input 0. Once the loop stops, I'd like to display the total number of items, average price, and total price using an else stat ...
Currently, I am attempting to dynamically set the selected attribute on an <option> element based on an array. Although I am very close to achieving my goal, I have not quite reached it yet... $departments = array("Finance", "IT", "Retail",); forea ...
Is there a better approach to determine if a condition matches any value in an array? For example, if I want to implement retry logic when receiving a 5xx error. var searchUserRequest = httpClient.request(searchUserRequestOptions, (res => { if(r ...
Okay, so here's the deal - I have this if statement that checks a ton of POST variables for certain conditions. if( (isset($_POST['billing_company']) && $_POST['billing_company'] != "") && (isset($_POST[&a ...
Consider the following two code snippets: if a and b: then do something if a: if b: then do something What sets these two statements apart in terms of semantics and execution time? Despite appearing similar, are they guaranteed to always ...
I am having trouble initiating an if statement from number 0 once the window is loaded, as it seems to be skipping over 0 and starting from 1 instead. Can someone please assist me in understanding how this works? showAnime = () => { let counter ...
I have been searching for a solution to my problem, but I haven't found anything that really helps. What I am looking for is a shortcut within an ng-click directive where there is only an if condition without an else expression. Essentially, I just want th ...
My goal is to determine whether the user signed in is an admin or not. User data is structured like this: [ { "isAdmin": "true", "_id": "60c6df22f25d381e78ab5f31", "name": "Admin", ...
Is it possible to use different expressions besides checking for the browser or version of IE in order to display/hide content? For example: <!--[if 1 == 0]--> This should be hidden <!--[endif]--> I am considering this option because I send o ...
I am having trouble with my JQuery code that checks multiple conditions. No matter what I enter, it always goes to the else condition. $(function() { $('#installment').on("keydown keyup", check); function check() { var inst = Number($("#installm ...
Just a heads up: I am currently in the learning process. While I have some experience with PHP, my knowledge of Java is very limited or non-existent. In the past, I've received negative feedback due to this lack of experience. So, here I am giving it ...
console.log("variable = " + JSON.stringify(result.something)); After running the code, I see that variable = null However, when I add this condition: if (result.something != null || result.something != '') { console.log('entered'); } The output is ...
Seeking assistance in comparing 2 dates using JavaScript has been a bit challenging for me. I haven't found the exact solution on this platform yet. As a beginner in JavaScript, I initially assumed that obtaining the current date and time would be a s ...
I'm just starting out and I've been working on an iterative calculation in Python that looks like this: for i in range(30): if i<10: p = 1 if 10<=i<20: p = 2 else: p = 3 But when I run the code, for the case wher ...
I have been experimenting with the if-then-else statement in JSON, but I am encountering some issues with it. { "type": "object", "minProperties": 2, "maxProperties": 2, "properties": { "human": { "enum": [ "Kids", "Ad ...
I am trying to find a solution for hiding a div generated by a plugin when disabled=true. I have been researching on SO and came across the idea of using .attr to locate disabled=true and then adding a CSS class with display: none to hide it. Unfortunately ...
I have encountered this code snippet: function auto_select_param_call_time() { if (today() == date("02.01.2017") || today() == date("03.01.2017")) { auto_click_param("call_time", "Non-working day"); } else { //Do something else ...
I am aiming to assign a class using a single-line if statement as outlined in this source. Currently, I am utilizing Material-UI and attempting to specify a class. Therefore, I would like to implement this approach: if(condition) expression <Typogr ...
I've been tackling a challenge with designing a navigation bar that consists of 3 items. The goal is to have the clicked item move to the center position on the horizontal navbar while re-arranging the order. Here's the code snippet I've come up with so fa ...
I'm working on a way to capture the IP address of a user and save it in a text file when they pay to access specific content. Once the IP is saved in the logFile.txt, I want to redirect the paying user to an exclusive content page. Additionally, I&apo ...
My current task involves fetching data via AJAX and then using a for-loop and if-statement to determine which goods belong in each shopping cart. Once identified, I need to display these goods in separate tables corresponding to each customer. Although the ...
$("#bottomWatch").click(function(){ var doops = $(".videoMove").display; if (doops == "none") { $("#video").css("left","15%", "display: block"); } else { $(".videoMove").cs ...
In my JSX Return() code, I am encountering an "If" issue when one of my conditions has 2 different 'onClick' events. There are 2 'a' tags, where one will display button 'X' if a statement is true and the other will display but ...
for num in range(0,len(input_user)): if input_user[num] == ('-'): if (input_user[num - 1].isalpha() and input_user[num + 1].isalpha()): goal += input_user[num] else: ...
Having trouble phrasing the question, apologies! Take a look at this fiddle to see my objective: http://jsfiddle.net/SzQwh/. Essentially, when a user checks checkboxes, they should add up to 45 and the remaining checkboxes should then be disabled. The pr ...
I am attempting to create a basic if statement that relies on the value of a cookie. The function looks like this: function setHomePage() { if ($.cookie('settingOne') == 'jjj') { $('.secO').css('display', & ...
I am in the process of creating a form that allows users to customize and order pizza while showing them the invoice as they make their selections. Currently, I have successfully implemented the display of user-selected options, but I am struggling with a ...
I am currently dealing with an HTML table. When I select a checkbox, I aim to compare the values of the cells in each row. This comparison works correctly for the first row, but it does not work for any subsequent rows. HTML Code - <form role="fo ...
I'm struggling to write some if/else conditions within a jQuery ajax method. My knowledge of jQuery is limited, so I may have made a small mistake in the syntax. Here's what I have: function swapContent(count, product) { $.ajax({ typ ...
I am currently working on a task involving echoing a list from MySQL using a while loop. However, the list appears to be in the wrong order when viewing it here on . Why is this happening? The purpose of the if statements is to ensure that the top and bot ...
I'm facing an issue: I need to display only the "nameProcess" and "id" in the table that have the attribute "error = true" in the json file. I've fetched the data but now I'm struggling to implement the condition inside my function. Can anyone offer assi ...
Currently delving into the pages of "Python 3 Object-Oriented Programming by Dusty Phillips," I stumbled upon a coding snippet that has left me scratching my head. It involves the use of square brackets [] following an if-else statement—a syntax unfamili ...
I am currently working with Weasyprint to showcase some Jinja templates within a Flask Web App. Here is the JSON data I am using: value=["1","2","3","4"] My goal is to pass the 'value' variable to another Jinja template within an if statement. {% if (v ...
Looking for a way to create a secure PHP page with a function that checks the token passed in via POST and the one stored in the session. However, I don't want to use multiple if statements like this: function CheckToken(){ if(isset($_POST['token']) & ...
I'm currently facing an issue where I need to display different icons next to documents based on their file types using Angular framework. However, no matter what file type I set as the fileExtension variable (e.g., txt or jpg), it always defaults to ...
Is it possible to check the object type from the request body and then execute the appropriate function based on this type? I have attempted to do so in the following manner: export interface SomeBodyType { id: string, name: string, [etc....] } ...
Currently, I am attempting to retrieve data from the database while implementing specific conditions due to the fact that the code is causing significant strain on the page. The query I am utilizing for this purpose is as follows: Select * From users If ...
Working on a custom website for a non-profit organization and I'm stuck on the search page. Here's what's going on... The search results are showing up, but when there are no results, nothing is displayed. I can't seem to figure out this issue. while($r ...
I have a simple login form and I want to include some validations. Here is what I have come up with: $errors = array(); if($_SERVER['REQUEST_METHOD'] == 'POST'){ if(0 === preg_match("/.+@.+\..+/", $_POST['email'])) ...
I'm working on implementing Conditional Tags to toggle a CSS class on or off based on the current displayed page. However, I'm running into an issue where the code isn't executing properly. There might be a syntax or logic error causing the problem. My pla ...
I've scoured the forum without finding a solution to my issue. I need to generate different outcomes based on the data sent to my page. Here's the code: $picture=$_GET['pic']; echo "Picture ref= " . $picture . "<br>"; if ($pictur ...
In an effort to control the thumbnails displayed on the frontend of my shop, I've been using the following function: However, I've encountered a problem when attempting to include the following code snippet: else { echo woocommerce_get_product_th ...
When attempting to choose a value from a dropdown using Python, the code I have looks something like this: def selectDropdown(self, locator, value): select_box = self.driver.find_element_by_id(locator) select_box.click() options = [x for x in ...
Currently, I am referencing a value obtained from an HTML form which corresponds to price ranges. For instance: 0 represents any price, 1 denotes $0 to $100, and so on. I can't help but feel that there must be a more Pythonic or efficient approach to hand ...
As a newcomer to React development, I am currently in the process of tidying up my code. One issue that I am facing is how to deal with a particular function while minimizing the use of if-else statements. const calculatePerPage = () => { if ...
Is it possible to use an if statement in a repeater like this? <%#Eval("FN").ToString().Count > 0 ? "SB" : "" %> When I try to implement this, I receive an error 73 indicating that the > operator cannot be used. How can I adjust it so that i ...
Good evening everyone, I am currently working on extracting data from a specific website: The program follows a loop-based logic. Upon opening the website page, the first step is to access the calendar and check for any matches played in the current mon ...
Currently, I am in the process of developing a game and have encountered an issue with implementing a new item for purchase. Despite having all the necessary components in place, the code seems to be skipping over the function unexpectedly. function buy ...
Currently, I am working on a shopping basket program and I encountered an issue where the "elif" statement is being printed after certain items like "ham" have been entered. Why is this happening? I have already attempted to include the while loop in the ...
Looking to determine the length of Character Length in my Custom Post Type post->content. The content is being displayed with a limit of 200 words. <?php $content = get_the_content(); echo substr($content, 0, 200); ?> If the character count exc ...