I am trying to first getting the value of a div, then adding character such as (+,-,%) to the value where there are spaces. Once done, I then need to set this value on another div. Is this possible to do in jquery. Is this possible to do i am a little confused.
Currently I can get the value of a div using:
$(document).ready ( function () {
$("#btn1").click ( function () {
alert ( $(".eventLocation").html() );
});
});
alert is used to check that I actually get the value of . This works fine, but then I am not too sure on how to add the characters if the value has spaces. For example if the value in the div is “RH3 3HF” then the character “+” has to be added where the space is so in between “RH3” and “3HF”. Then this formatted value has to be to another div.
Any suggestion on this will be greatly appreciated as I am not too sure on how to proceed.
this should do what you need…
Here is a working example
Based on your comments…
Assuming that Div1 only has one link you can do this to get the href value…