"Having trouble with jQuery's show and fadeIn functions - they're not

I'm currently working with some basic jQuery functions like show and fadeIn, but for some reason they're not functioning properly. Can you point out what I might be doing wrong? The script is definitely being processed as I can see the "It works" message being displayed in the console.

Here's the script:

$(document).ready(function(){
$('#submit').on("click",function(e){
    e.preventDefault();
    console.log("It works");
    $("#username-triangle").show('slow');
    $("#username-error").fadeIn(500);
    $("#password-triangle").fadeIn(500);
    $("#password-error").fadeIn(500);
    $("#form input").addClass("error-glow");

});
});

A snippet of the HTML:

 <div class="login-form">
             <div class="username-triangle" id="username-triangle"><img src="img/triangle.png"></div><!--username-triangle -->
             <div class="error username-err" id="username-error">
                 <img src="img/error.png">
                 <p>Wrong Username</p>
             </div><!--end error username-err -->
             <div class="password-triangle" id="password-triangle"><img src="img/triangle.png"></div><!--end password-triangle -->
             <div class="error password-err" id="password-error">
                 <img src="img/error.png">
                 <p>Wrong Password</p>
             </div><!--end error passsword-err -->

A part of the CSS where elements have their visibility set to hidden:

.username-err
{
visibility: hidden;
position:absolute;
margin-top: 64px;
margin-left: 310px;
}
.username-triangle
{
visibility: hidden;
margin-top: 70px;
margin-left: 299px;
position: absolute;
z-index: 3;
}

Answer №1

Instead of utilizing the property visibility: hidden; in your CSS class, consider using display:none.

Replace visibility:hidden with display:block in your CSS.

Additionally,

Substitute

$('#submit').on("click",function(e){

With

$('#submit').click(function(e){

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

AJAX Dropdown in Laravel with Append and Event Handling (Method Not Allowed Error)

I recently delved into the world of Ajax, but I'm feeling quite confused and encountering errors even after following some tutorials. The goal is to change or refresh the page to display the dropdown menu data once it has been clicked. Can someone ple ...

Why isn't my redirection functioning properly?

My code is having an issue with the redirect function being called too early, causing the last file of a batch upload to fail. I've been searching all morning and trying different solutions without success. function uploadFile(something, callback) { ...

Utilizing jQuery's .done() and .fail() methods to handle

Our goal here is to control the outcome of the createSite function. If it returns {ac:failed}, then the .fail(failOption) will be triggered; otherwise, the sendMail or .done(sendMail) function will be executed while still retaining the data from the crea ...

Creating a nested function and utilizing the return statement in JavaScript

I am facing an issue with my custom function that contains an ajax call. I need to retrieve a variable from the ajax function within my custom function, but I'm unable to do so. Why is this happening? Possible solution 1: <script> function ...

Unable to Pause Video with Javascript

I have a project with a video that plays in a continuous loop. Below is the HTML code for the video tag: <video playsinline autoplay muted loop id="myVid"> <source src="River.mp4" type="video/mp4"> </video> My goal is to make the vi ...

Is having an objectType inside of the same object achievable?

I've been attempting to implement a feature where multiple "trainings" can be included within the training type, with the goal of merging them once the user has both. Despite my efforts, I haven't been successful in getting it to work and I' ...

Activate search bar expansion when search input is in focus

I'm currently focusing on the frontend development of an app where search functionality is paramount for user interaction. In light of this, I am considering placing the search feature at the bottom of the screen so that it can be easily accessed with ...

Nuxt.js transition issue: How to fix transitions not working

LOGIC: The pages/account.vue file consists of two child components, components/beforeLogin and components/afterLogin. The inclusion of child components is based on a conditional check within pages/account.vue using a string result ('x') stored in ...

using ng-include and ng-view to manage variable scope

I am encountering an issue with my scope variables. Currently, I have an index.html file which includes a navbar using ng-include: <div class=col-xs-9 sidebar-offcanvas" id="sidebar" role="navigation ng-include="'views/common/navside.html'"&g ...

Experiment with a ThreeJS, Websockets, and NodeJS Client/Server Interaction

Exploring the possibilities of socket.io, ThreeJS, Javascript, and NodeJS, I embarked on a project to create a simple client/server setup using ThreeJS's graphics. While uncertain if these frameworks would seamlessly integrate, I decided to take a cha ...

Using Jquery to monitor input field modifications following a background ajax refresh

I am facing a challenge with my two JQuery functions. The first function executes an ajax load based on the user's selection from a drop-down menu, and then updates an input field according to the data returned. This function is working correctly. // ...

Troubleshooting issues with locating nested elements using Xpath in Selenium

Given the provided website URL and locators: XPATH CONTAINER = (By.XPATH, '//ul[@class="bottom-nav"]') MENU = (By.XPATH, '//li[contains(@class, "menu-item")]') CSS BOTTOM_NAV = (By.CSS_SELECTOR, '.bottom-nav&a ...

Has Next.js incorporated a maximum cache size feature along with an invalidation algorithm like LRU?

Currently, I have a Next.js site that utilizes getServerSideProps for data fetching. However, I am interested in switching to getStaticProps and implementing incremental static regeneration (ISR) for improved performance. Currently, my memory usage is ap ...

What is the optimal method for iterating through every element in a string array?

Within my code, I am dealing with an array named var mya = ["someval1", "someotherval1", "someval2", "someval3"];. The goal is to have a function that receives an object with a property set to one of these values. Instead of simply iterating over the arra ...

Unable to retrieve file on Linux system through PHP

<?php // Ensuring that an ID is provided include('include/function.php'); if(isset($_GET['id'])) { // Retrieving the ID $id = intval($_GET['id']); // Validating the ID if($id <= 0) { die('Th ...

Is there a way to keep a div element stationary during scrolling without using fixed positioning?

Is there a way to prevent a div from moving when scrolling up or down without using the position:fixed property? When an element is fixed, the scroll bar disappears making it impossible to reach the element by scrolling. div{ position:fixed; top:1 ...

Learn how to utilize Vue 3 to access properties that have been passed down from a parent component, even if they

Hey there, hope everything is going well. I'm familiar with react.js, but when I gave vue a try, things felt a bit different. In react, it's easy to access props passed from the parent in the child component without much hassle. However, in vue, ...

Issues with footers in IE 10/11 and Edge when using Grid layout

In the latest versions of Chrome, Firefox, Opera, IE 10/11 and Edge, the Grid layout below works perfectly fine. The only issue is with the Microsoft browsers where the footer fails to start scrolling when the content exceeds the screen size, leaving it fi ...

Guide to integrating numerous product filters for an ECommerce platform using Spring Boot, JavaScript, Ajax, and MySql

Currently, I am developing an E-Commerce Web App using Spring Boot which includes a feature to add multiple product filters. The user can select checkboxes corresponding to their preferences for filtering or searching products from the store. However, I am ...

Tips for manipulating deeply nested arrays of objects within an array with JavaScript

I need assistance with calculating the average of ratings within nested array objects that are inside another array. Below is the array provided: let arr = [ [{"category":"behavioural", "rating":3}, {"category":& ...