Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8674631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:45:18+00:00 2026-06-12T19:45:18+00:00

My jQuery code does not work as expected. Here is the HTML: <a href=>Some

  • 0

My jQuery code does not work as expected.

Here is the HTML:

<a href="">Some link</a>
<br/>
<a class="delete_file_initial" href="">Delete file</a>
<span class="delete_file_question hide">are you sure to delete?</span>
<a class="delete_file_question confirm hide" href="http://example.com/delete">yes</a>
<a class="delete_file_question cancel hide" href="">no</a>
<br/>
<a class="move_file_initial" href="">Move file</a>
<span class="move_file_question hide">are you sure to move?</span>
<a class="move_file_question confirm hide" href="http://example.com/move">yes</a>
<a class="move_file_question cancel hide" href="">no</a>

And the Javascript:

$(function() {
    // delete file
    $("a.delete_file_initial").click(function(event) {
        event.preventDefault()
        $(this).hide()
        $(".delete_file_question").show()
    });
    $("a.delete_file_question").click(function(event) {
        if ($(this).hasClass("cancel")) {
            event.preventDefault()
            $(".delete_file_question").hide()
            $(".delete_file_initial").show()
        }
    });

    // move file
    $("a.move_file_initial").click(function(event) {
        event.preventDefault()
        $(this).hide()
        $(".move_file_question").show()
    });
    $("a.move_file_question").click(function(event) { 
        if ($(this).hasClass("cancel")) {
            event.preventDefault()
            $(".move_file_question").hide()
            $(".move_file_initial").show()
        }
    });

});

There are two similar code blocks: delete and move. They are supposed to do the same thing except that the actual URLs to load are different.
Expected behaviour is as follows. A user clicks on the link “delete”/”move”, then a confirmation link is shown, and he confirms or cancels the action.

The problem is that when I click on the link “delete_file_initial”, it hides, but the links “delete_file_question” do not show up, leaving a blank line. The “move” block works as expected. And if I comment the “move” block, the “delete” block starts working as expected. What’s even more strange is that this bug appears in Google Chrome 22.0.1229.79, but in Firefox 15.0.1 everything works fine.

How to fix this bug?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T19:45:20+00:00Added an answer on June 12, 2026 at 7:45 pm

    The problem was not in the javascript, but, strangely, in the HTML code. I removed the first <br/> tag before <a class="delete_file_initial" href="">Delete file</a>, and it started working properly. The whole code block was a series of <a> tags separated by <br/> tags. I replaced them with a simple <ul><li> structure, and the problem has been solved, keeping the original layout and functionality.

    If anyone understands the reason for this problem, please let me know.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use .is(':visible') method in jquery but it does not work as expected. Here
My javascript/jquery code var galcont = $(#content div.lt2); $(galcont:eq(0)).css(opacity,0.5); Does not work But $(#content
I have the below code that does not seem to work at all :(
The above code does not work properly. I need to implement a simple menu
I have this jquery code: var response = $(div.callbacktwo).html(result); if (response == 'Added!'){ //some
On my main page I have this jquery code which does an ajax call
I am newbie to jQuery, can someone explain what this code does: $(#currency form).submit(function(e)
what does this code performs? if(object.jquery){ .... } I don't know what jQuery attribute
jQuery code: function ajaxsubmit(){ $.ajax({ url: /update, type: POST, dataType: html }).success(function(data) { $('#result').html(data);
My jquery code It's not working when $(a).on(hover,function(){$(this).css(background,#ccc);},function(){$(this).css(background,#fff)}); But is working when $(a).hover(function(){$(this).css(background,#ccc);},function(){$(this).css(background,#fff)}); How

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.