• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 303
  • Last Modified:

Using Jquery to change attribute title

Hello experts.
I need help to replace the content of a attr. title with the response after ajax call.
(my enable_reset_action.cfm is returning a value like:Lastenable:10/10/2011 ) wich i want to use for title="Lastenable:12/08/2011")

Please check if the way i'm trying to do this is (1.get the id value and 2.pass it to the action page 3.use the response) is the right way.

Notice that i can't use : $("#resetid_BE674161-D89C-AA62-077B1DA2E6C8D4AE") for the a tag id because it is a value from an output query.

below is my code.
Any help?
<style type="text/css">.red{color:#F00;}.orange{color:#F90;}.green{color:#0F3;}</style>
<script type="text/javascript" language="javascript" src="../js/jquery-1.6.2.min.js"></script>
<script type="text/javascript">
var enableitem = function(id){
  var atagid = '#resetid_' + id;
		 $.ajax({
			type: "GET",  
			url: "customer_items/includes/enable_reset_action.cfm",  
			data: {art_id: id },  
			success: function(theResponse) {
			 // $(atagid).attr("title").(theResponse);
              $(atagid).removeClass("red");
              $(atagid).removeClass("orange");
			  $(atagid).addClass("green");
			}
		  })
       }
</script>
<a id="resetid_BE674161-D89C-AA62-077B1DA2E6C8D4AE" onclick="enableitem('BE674161-D89C-AA62-077B1DA2E6C8D4AE');return false;" class="fg-button ui-state-default ui-corner-left blink red" title="Lastenable:12/08/2011" href="#"><b>Enable</b></a>

Open in new window

0
Panos
Asked:
Panos
  • 2
1 Solution
 
dirknibleckCommented:
This:
// $(atagid).attr("title").(theResponse);

Should be:

$(atagid).attr("title", theResponse);
0
 
PanosAuthor Commented:
Hi dirknibleck
It was very close!
Thank you for your help. It is working now.
0
 
PanosAuthor Commented:
Thank you .
Regards panos
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now