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 8049405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:46:37+00:00 2026-06-05T06:46:37+00:00

JS code: var forma = $(‘form#mali_oglas’), pomoc = $(‘div[role=pomoc]’), div = $(‘.mali_oglas_pomoc’), input =

  • 0

JS code:

var forma = $('form#mali_oglas'),
    pomoc = $('div[role=pomoc]'),
    div = $('.mali_oglas_pomoc'),
    input = forma.find('input, textarea');   

    input.on('click', function(){
        var name = $(':input:focus').attr("name")
        pomoc.fadeOut('fast', function(){            
            div.find("[data-pomoc='" + name + "']").fadeIn('slow');            
            console.log(name);
        });
    });

HTML code:

<div class="mali_oglas_pomoc">
    <div data-pomoc="name" role="pomoc">
        1Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi pretium, urna nec varius sollicitudin, erat urna accumsan sapien, vel interdum enim risus id mi. Class aptent taciti sociosqu ad litora.
    </div>
    <div data-pomoc="body" role="pomoc">
        2Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi pretium, urna nec varius sollicitudin, erat urna accumsan sapien, vel interdum enim risus id mi. Class aptent taciti sociosqu ad litora.
    </div>.....    
</div>

CSS for the div in question:

div[role="pomoc"] {position: absolute; top: 45px; right: 0;width: 250px; display: none}
div[role="pomoc"]:first-child {display: block}

It is working, but a bit strange. First it is applying display block to the targeted div, then fading it out and fading in. What is going on?

Link:
http://jsfiddle.net/AY2B3/

  • 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-05T06:46:38+00:00Added an answer on June 5, 2026 at 6:46 am

    The fadeOut callback is fired once for each completed animation. In your example, the callback gets executed multiple times because pomoc contains multiple elements. The strangeness is probably a visual artifact related to calling fadeIn multiple times on the same element.

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

Sidebar

Related Questions

first my code: var form = $(#form_usr);//An empty div to load an html fragment
My code: var parent = document.createElement('div'); var pen = document.createElement('div'); var dog = document.createElement('div');
In the controlle,r I have this code: var result = Request.Form[0]; where result has
Form sending AJAX code: var str = $(form).serialize(); alert(str); // var uns=@unserialize(str); //alert(uns); $.ajax({
I have the following code: var formSubmitHandler = function (link, form) { //e.preventDefault(); var
I have this ajax jquery code: var form = document.getElementById('frm'); var data_string = form.serialize();
I have the following Javascript code: function checkIfValid(){ var form = document.createuserform; var valid
I have the following Javascript code: function checkIfValid(){ var form = document.createuserform; if(form.fName.value ==
I have created RadioGroup using the code var radios = new Ext.form.RadioGroup({ columns :
I saw this in some code: var _0xdf50x7 = document['createElement']('form'); How does this work?

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.