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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:33:23+00:00 2026-05-29T23:33:23+00:00

I realized something weird when I’m coding in javascript, especially with some jquery functions.

  • 0

I realized something weird when I’m coding in javascript, especially with some jquery functions.

Here’s my code

<?php // Encoded in UTF-8
    if(isset($_SESSION['username']))
    {
?>

<script type="text/javascript">
    function showEvent(nid)
    {
        $j=jQuery.noConflict();
        $j.get("getGestionEvent.php?type=show&nid="+nid, function(data){
            document.getElementById("eventdiv").innerHTML = data;
        });
    }
</script>

<h2> Event </h2>
<fieldset>
<legend> Add </legend>
<div style="margin-top:10px;">
    <label for="date"> Date : </label>
    <span style="margin-left:20px;">
        <button id="ButtonCreationDemoButton">
            <img src="img/calendar.png" alt="[calendar icon]"/>
        </button>
    </span>
</div>
<form name="events" action="index.php?p=event" method="post">
<div style="margin-top:5px;">
    <span style="margin-left:-1px;">
        <input type="text" name="ButtonCreationDemoInput" id="ButtonCreationDemoInput"/>
    </span>
</div>
<div style="margin-top:10px;">
    <label for="date"> Description : </label>
</div>
<div style="margin-top:5px;">
    <span style="margin-left:-1px;">
        <input type="text" name="desc" id="desc" maxlength="100">
    </span>
</div>
<div style="margin-top:5px;">
    <input type="submit" value="Ajouter">
<div>
</fieldset>
</form>
<div id="eventdiv"></div>
<script type="text/javascript">
    // If I don't call the function, the other script doesn't make an error
    showEvent(0);
</script>

<script>
    $('#ButtonCreationDemoButton').click(
      function(e) {
        $('#ButtonCreationDemoInput').AnyTime_noPicker().AnyTime_picker().focus();
        e.preventDefault();
      } );
</script>
<?php
    }
    else
    {
        echo '<p style="color:red"> You cannot see this page. </p>';
    }
?>

This is a simple form with 2 textbox, but I have a button with an image of calendar to make appear a calendar on top of the textbox ButtonCreationDemoInput to make the user choose a date easily. If I remove the line that call the function showEvent(), the calendar show with no problem. But if I let the the function there, I get the error and I don’t see the calendar :

Uncaught TypeError: Property ‘$’ of object [object DOMWindow] is not a function

and it points on the line : $(‘#ButtonCreationDemoButton’).click(

By the way, showEvent only give the div called eventdiv a table of data from a database.

This is not the first time that I see this kind of problem. This only happen when I’m reaffecting the content of a div.

Can someone help me with this please?

  • 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-05-29T23:33:24+00:00Added an answer on May 29, 2026 at 11:33 pm

    $ is the standard variable alias for the jQuery object. BUT you are using jQuery.noConflict();. That removes the $ alias. Instead, you have to use the word jQuery, i.e. jQuery('#ButtonCreationDemoButton').

    Basically, showEvent() gets called, removes the $ alias, and then you try using it in the following script tag.

    However, in your code you don’t just call jQuery.noConflict(), you assign it to the variable $j. This allows you to use $j as the jQuery alias, i.e. $j('ButtonCreation...').

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

Sidebar

Related Questions

I'm tinkering with some code and I realized something I never knew. A normal
EDIT: I realized that this code compiles and works: #include <iostream> template<class Something> class
I was debugging something in my code and realized that the following compiles NSMutableSet
I started coding something complicated and then realized my event handlers don't work, so
I was going through some notes and I realized something is amiss. When emulating
I just realized something crazy, which I assumed to be completely impossible : when
I realize it's probably something strange, but here is what I have. I have
I realized that I can have problems with single quotes in php arrays: <?php
Ok this is something weird. I got authlogic-oid installed in my rails app today.
OK, I realize that question might seem weird, but I just noticed something that

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.