Conflict of jQuery

Asked

Viewed 1,732 times

1

I’m having a jQuery conflict. I use an Admin, where there are several resources ready. I needed to add an autocomplete

When after I finished I realized that the menu was no longer opening...

This is the menu and all Admin

<script src="assets/js/jquery-ui-1.10.3.custom.min.js"></script>

This is the autocomplete

<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>

Code of the Autocomplete

$(function() {
    var availableTags = [
        <?php do { ?>
        {label: '<?php echo $row_rsOrigem['rsocial']; ?> - <?php echo $row_rsOrigem['cpf_cnpj']; ?>', value: '<?php echo $row_rsOrigem['cpf_cnpj']; ?>'},
        <?php } while ($row_rsOrigem = mysql_fetch_assoc($rsOrigem));?>
    ];

    $(".origemCPF").autocomplete({
        source: availableTags
    });
});

It is possible to use both, without having problems between them?

  • Remove one of them, which appears second.

  • @Sergio I did it, but if I take one, the other one stops working.

  • Error in browser console when trying to open MENU ?

  • Since the first one is custom, it may not contain what is needed for the autocomplete. Just leave jQuery-ui complete to test.

  • @Diegosouza no error appears. I click on the menu it goes down and up again. No fixed to click.

  • @Luishenrique I made the exchange. I put one and then the other. But always one is not working.

  • Tiago: you have to take one, you really have to do it. Then you have to understand why it makes mistakes. Do you have it online? Can you show the link? What role did you move to make it work? Was it a scope problem? For in the code you have in question that functionfilterArrayForString is locked inside a scope and I don’t see it being called in that scope which means it’s not possible to use it...

  • @Sergio I’m testing on localhost. I removed the filterArrayForString and yet I didn’t get better.

  • What a mistake on the console?

Show 4 more comments

2 answers

3

Try to use jQuery.noConflict().

var $jQuery = jQuery.noConflict();

$jQuery(document).ready(function() {
  $jQuery("#ad").fadeIn("slow");
  $jQuery("#close").click(function () {
    $jQuery("#ad").fadeOut("slow");
  });
});

0


Have you ever tried taking one, testing and then taking the other and testing?? Because what I’m seeing are both the same version.

Try this: Take one and see that it stops working, then take the other and see what stopped.

Most likely jquery-ui-1.10. 3.custom.min.js must have undergone some change.

If it is possible send the conflict that this generating.

  • I’ve done it, without a crash.

  • Does it stop working all or just a feature??? (Didn’t I see that you had already solved it)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.