Daniel Ellison
Daniel Ellison

Reputation: 1349

Jquery - Store text in a variable

Im sure this is simple question but not able to find clear information regarding how to store text in a variable? What I was hoping to do is use Jquery to replace text from a TD and covert it into a link.

For example in my table td I would get a reference number such as 20150326105 and I would like jquery to replace that text so that it converts it to the following:

http://ticketingsystem.com/UpdateNotification.asp?OEN=20150326105&CL=ALL&SU=ALL

I want to add the reference number right after the OEN=. Is this something it is possible?

Upvotes: 1

Views: 2010

Answers (1)

D4V1D
D4V1D

Reputation: 5849

Of course this is something which is possible.

jQuery(function($) {
    var oen = $('td').text();
    var url = 'http://ticketingsystem.com/UpdateNotification.asp?OEN='+oen+'&CL=ALL&SU=ALL';
    $('td').html('<a href="'+url+'">'+oen+'</a>');
});

Is that what you were looking for? Without any code, it's hard to be sure of that.

Upvotes: 2

Related Questions