Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to get dynamic attri('id') before displaying on content
23rd August, 15:48
Post: #1
how to get dynamic attri('id') before displaying on content
Hello ,

I am trying to get attri('id') before displaying on qtip content

My html code

JS Code
<a class="aa" href="" id="1_1_0">dddd</a>
<a class="aa" href="" id="1_1_1">eeee</a>
<a class="aa" href="" id="1_1_2">ggggg</a>
<a class="aa" href="" id="1_1_3">uuuuu</a>


My qtip code

JS Code
<script type="text/javascript">
        $(document).ready(function() {
         $('a.aa').each(function(){
    $(this).qtip({
<?php $aa = '$(this).attr(\'id\')';  
 
  if ($content == '1_1_0')
{
   $ddd = 'yes';
}
    else
{
    $ddd = 'no';
}      
?>
 
content:    <?php echo '"'.$ddd.'"' ?>
 
        style: {
                          padding: '10px 10px',
                          color:'#fff',
                          border:'1px solid #195fa4' ,
                          tip: 'bottomLeft',
                          name: 'dark'
                       },
 
                position: {
                    adjust: {x: -30,y: -70}
                          },    
 
 
});
});
        });
        </script>



that will always say no. Is there any way to do this.

Please advice how to do that.

Many thanks,
david
Find all posts by this user
Quote this message in a reply
23rd August, 16:33
Post: #2
RE: how to get dynamic attri('id') before displaying on content
Uh... I'm not entirely sure what it is you're doing here to be honest... can you explain what this is supposed to do? You realise PHP code is only evaluated once for the entire page when it's rendered right?

Craig Thompson
Web Developer / Designer
Craigsworks
http://www.craigsworks.com
Visit this user's website Find all posts by this user
Quote this message in a reply
23rd August, 17:32
Post: #3
RE: how to get dynamic attri('id') before displaying on content
(23rd August 16:33)Craig Wrote:  Uh... I'm not entirely sure what it is you're doing here to be honest... can you explain what this is supposed to do? You realise PHP code is only evaluated once for the entire page when it's rendered right?

Hello , thanks for your reply , what i am trying to do is
in my html code

JS Code
<a class="aa" href="" id="1_1_0">dddd</a>
<a class="aa" href="" id="1_1_1">eeee</a>
<a class="aa" href="" id="1_1_2">ggggg</a>
<a class="aa" href="" id="1_1_3">uuuuu</a>


i got id id="1_1_0" , id="1_1_1" ,..... , these are $(this).attr('id')

in my php array >>>
$array = array('1_1_0' => "something 1" , "1_1_1" => "something 2"); .....etc

then i display tooltip content this value
content: <?php echo $array['$(this).attr(\'id\')']; ?> ,

so that i can get "something 1" , "something 2" ... etc on tooltip

i don't know how to pass this value

there is one in the forum
http://craigsworks.com/projects/forums/t...ript-array

var timetabledEvents = new Array(["1","01/04/2009 10�00","01/04/2009 .......); ....etc

but i don't want to print large amount of data like that on html output


Pleae advice is there any way to do that.


Many thanks,
david
Find all posts by this user
Quote this message in a reply
23rd August, 18:04
Post: #4
RE: how to get dynamic attri('id') before displaying on content
Unfortunately you can't do that. PHP is evaluated once to render the page, so your method won't work. Why don't you just stick the contents in the id attribute instead of the identifier? Or if it's HTML stick it in an element directly beneath the element in the DOM and use the .next() selector to grab it?

Craig Thompson
Web Developer / Designer
Craigsworks
http://www.craigsworks.com
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Problem displaying tooltip on keyboard focus! nick4501 1 65 15th May 08:39
Last Post: nick4501
  [Solved] Dynamic Content From Page Element frogg3862 2 89 3rd May 17:12
Last Post: frogg3862
  [Solved] qtip showing content from db doesn't change when content in db changes. vtoepel 2 144 23rd April 16:02
Last Post: vtoepel
  [Solved] IE 8 "Style > Tip" not displaying shameless hacker 30 8,974 9th February 18:49
Last Post: nickast
  Dynamic contenct not working property in sortable cleung 5 733 8th December 18:45
Last Post: Craig
  [Solved] dynamic tipcreation alnikitich 1 447 8th December 18:29
Last Post: Craig
  [Solved] stop tooltip from displaying knowlton 3 921 2nd October 13:12
Last Post: Craig
  [Solved] Dynamic content based off map area befeetback 1 1,046 25th August 18:23
Last Post: Craig
  [Solved] Dynamic content not showing? dabd 3 812 21st August 18:17
Last Post: Craig
  [Solved] dynamic content based on child eement yisman 8 1,228 27th July 14:29
Last Post: yisman



User(s) browsing this thread: 1 Guest(s)