I have a series of pages where I need to get a specific code for a button. I want to put the code that is in the url in a variable with jQuery.
Example URL: www.example.com/folder/code/12345/
I want to get the numerical part in a variable called (siteCode)
Thanks in advance for any answers.
jquery / Pseudo code:
var siteCode; // start function function imageCode(){ siteCode // equals number part of URL $('.button').attr('src', 'http:www.example.com/images/'+siteCode+'.jpg'); }
javascript jquery html url get
huddds
source share