on-internet
← Community

concat two strings in JQuery

Stack Overflow ·

Just like the title above: how to concatenate two strings in JQuery? This is my code so far: $(document).ready(function(){ serviceName = '<?=$_GET['services'] . ".php";?>'; serviceID='<?= "#" .$_GET['services'];?>'; serviceClass = '<?=$_GET['services'];?>'; if (serviceName != "") { alert(serviceID); $('.main_content').load(serviceName); $(serviceID).addClass("it"); } }); As you can see in my above code, in variable name serviceID, I am concatenating hashtag and my GET value and I try to put it on ALERT and the result is correct, but when I assign it to .addClass it’s not working. Any alternati

Comments

Sign in or sign up to comment and upvote.

No comments yet.