WordPress.org

Ready to get started?Download WordPress

Forums

my jquery not working proper way (8 posts)

  1. kumarsharmaatul
    Member
    Posted 1 year ago #

    i'm using

    it's working on local.html page but i need to work in wordpress page
    i creat a js file for the jquery it's working but problem is i need to show data into span tag by dropdown list like when i click delhi to show delhi data and when i click to mumbai show mumbai data the problem is the whole data show delhi span tag and other tag is empty

    (jQuery)(function($){
         $('body.page-id-369 #ato').change(function(e){
              $(".atul").css("display","none");
              $("#"+$("#ato option:selected").text()).show();
          });
    });
    
    <div id="add1">
    <table>
    <tbody>
    <tr>
    
    <td>
      <select name="menu" id="ato">
     <option>-Select One-</option>
        <option>Delhi</option>
        <option>Mumbai</option>
        <option>Banglore</option>
         <option>Gurgaon</option>
        <option>Punjab</option>
        <option>Gujrat</option>
         <option>Nagpur</option>
        <option>Kerala</option>
        <option>Kolkatta</option>
         <option>Andhra_Pradesh</option>
        <option>Chennai</option>
        <option>Mizoram</option>
       <option>Pune</option>
    </select>  <span id="Delhi" class="atul" style="display:none;">
    </span>
    
    <span id="Delhi" class="atul" style="display:none;">
    Delhi
    
    </span>
    <span id="Mumbai" class="atul" style="display:none;">
    Mumbai
    </span>
    <span id="Banglore" class="atul" style="display:none;">
    Banglore
    </span>

    [Please wrap your code in backticks in the future]

  2. Andrew
    Forum Moderator
    Posted 1 year ago #

    Can you demonstrate the code working on jsFiddle?

  3. kumarsharmaatul
    Member
    Posted 1 year ago #

  4. Andrew
    Forum Moderator
    Posted 1 year ago #

    Are you using your browser's console log to debug this?

  5. kumarsharmaatul
    Member
    Posted 1 year ago #

    yes

  6. kumarsharmaatul
    Member
    Posted 1 year ago #

    you can see http://jsfiddle.net/kumarsharmaaatul/EDFUH/6/ working but in my wordpress sit not working the whol data show delhi span tag

  7. Andrew
    Forum Moderator
    Posted 1 year ago #

    Anything revealing coming up? Any messages?
    Please note that it is very difficult to debug your issue without seeing it.

  8. kumarsharmaatul
    Member
    Posted 1 year ago #

    there is now error show, jquery not working properly in wordpress (jQuery)(function($){
    $('#ato').change(function(e){
    $(".atul").css("display","none");
    $("#"+$("#ato option:selected").text()).show();
    });
    }); you can see in jsfiddle.net the functionality is working but when i try to use in the wordpress not working the whole data show in delhi span tag i need to the data show individual span tags when i click to delhi to show delhi and when i click to mumbai show mumbai span text

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags