7 Replies - 698 Views - Last Post: 20 October 2011 - 12:13 AM

#1 sdo  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 59
  • Joined: 06-February 09

Class Selector Seemingly Not Working

Posted 19 October 2011 - 11:35 PM

Hey All,

I'm almost sure this is going to amount to some kind of interference from another script, but I can't get the following code to work:

HTML:

<div class="hello" id="hello">HELLO</div>


JS:


$(document).ready(function () {
$(".hello").html("ASJDASJKDBSAHDBJAS");
});


Now I can get it to work in a standalone application.. but not in the framework I need it to work in. Now everyone is going to tell me they can't help me without knowing what the code looks like but.. you really don't want to see the code in its entirety, and I really don't know what parts could be effecting the performance of the selector.. so I'm really just looking for some suggestions to help sniff out the root of the problem.

Some pertinent information may be that I have other plugins using jquery, and I also have another unrelated function (also using jquery) tied to the window.onload event. Everything else seems to work fine including page fading/unfading, side menu accordion action, cufon, etc.. just this section of code which I am going to be using to implement some database functionalities.. I discovered I can't get even the simplest selectors to work in the context though.

Any help is appreciated,

SDO

Is This A Good Question/Topic? 0
  • +

Replies To: Class Selector Seemingly Not Working

#2 sas1ni69  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 81
  • View blog
  • Posts: 430
  • Joined: 04-December 08

Re: Class Selector Seemingly Not Working

Posted 19 October 2011 - 11:40 PM

Have you tried looking at Firebug?
Was This Post Helpful? 0
  • +
  • -

#3 sdo  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 59
  • Joined: 06-February 09

Re: Class Selector Seemingly Not Working

Posted 19 October 2011 - 11:46 PM

View Postsas1ni69, on 20 October 2011 - 12:40 AM, said:

Have you tried looking at Firebug?


Hello again sas - though I do have FB, I have pretty limited experience with it. What would the best way to utilize FB be in this situation?

SDO
Was This Post Helpful? 0
  • +
  • -

#4 sas1ni69  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 81
  • View blog
  • Posts: 430
  • Joined: 04-December 08

Re: Class Selector Seemingly Not Working

Posted 19 October 2011 - 11:49 PM

Hi :) alright you should fire it up (F12) and try loading the page. Make sure your console is turned on. You can see that from the console tab. Then try reloading the page.

If there's an error or errors it'll prompt you in red text. You can click on each one to view it in detail. Maybe then it'll show you if something is clashing or if something is mis-typed or anything like that.

I hope this helps :)
Was This Post Helpful? 1
  • +
  • -

#5 sdo  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 59
  • Joined: 06-February 09

Re: Class Selector Seemingly Not Working

Posted 19 October 2011 - 11:56 PM

View Postsas1ni69, on 20 October 2011 - 12:49 AM, said:

Hi :) alright you should fire it up (F12) and try loading the page. Make sure your console is turned on. You can see that from the console tab. Then try reloading the page.

If there's an error or errors it'll prompt you in red text. You can click on each one to view it in detail. Maybe then it'll show you if something is clashing or if something is mis-typed or anything like that.

I hope this helps :)


It definitely does - I can see that there is a lot of debugging potential here. Now that I have identified some of the red DOM logs (which do have to do with jquery as we suspected), is there a way to get an indication of where the problem may be deeper in the nest? When I drill down it just shows the code in general without highlighting anything specific.

As a secondary thought, other than the red highlighted text, what does the bold or green text mean?

SDO

This post has been edited by sdo: 19 October 2011 - 11:56 PM

Was This Post Helpful? 0
  • +
  • -

#6 sdo  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 59
  • Joined: 06-February 09

Re: Class Selector Seemingly Not Working

Posted 20 October 2011 - 12:04 AM

SUCCESS! Though I can't really take credit for coming to any logical conclusion based on careful thought and consideration, using the previous suggestion I was looking through the DOM events in FireBug and noticed a constructor of a widget I wasn't actually using on this page. Being a little OCD, I used PHP to make the constructor conditional depending on which page you are visiting so that it is only called on the pages that it is required. This widget must have been causing the conflict as when I made the patch my selectors started functioning as normal.

I noticed that this widget was using some kind of jquery method:
jQuery.noConflict()


I wonder if this method was what caused the strange functionality problems? I'll have to read into this further.

SDO
Was This Post Helpful? 0
  • +
  • -

#7 sas1ni69  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 81
  • View blog
  • Posts: 430
  • Joined: 04-December 08

Re: Class Selector Seemingly Not Working

Posted 20 October 2011 - 12:08 AM

Hehe yes I've come to love firebug so much. If you have an error in the error console, you can view it specific details but not as much on the DOM console.

I'm not entirely sure of the bold green text but if I had to guess it'll be things that are loading correctly either from the browser or jQuery :D

I have never officially searched for help on firebug but maybe the wiki page will help the both of us :)
Was This Post Helpful? 0
  • +
  • -

#8 sas1ni69  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 81
  • View blog
  • Posts: 430
  • Joined: 04-December 08

Re: Class Selector Seemingly Not Working

Posted 20 October 2011 - 12:13 AM

View Postsdo, on 20 October 2011 - 03:04 PM, said:

SUCCESS! Though I can't really take credit for coming to any logical conclusion based on careful thought and consideration, using the previous suggestion I was looking through the DOM events in FireBug and noticed a constructor of a widget I wasn't actually using on this page. Being a little OCD, I used PHP to make the constructor conditional depending on which page you are visiting so that it is only called on the pages that it is required. This widget must have been causing the conflict as when I made the patch my selectors started functioning as normal.

I noticed that this widget was using some kind of jquery method:
jQuery.noConflict()


I wonder if this method was what caused the strange functionality problems? I'll have to read into this further.

SDO


I'm really glad! At least it's functional now, you can now slowly look into it. I'm not sure if it's the noConflict function which is causing the error. But sometimes when you're using a framework, they expect you to code in a strict format on some parts. Maybe this have upset the framework in one way or another and that's why you were getting the error.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1