Here is the code:
<span class='maincaptionsmall'>
Test
</span>
For some reasons of ajax and jquery codes in my page, I can't use HREF as Link, I mean, I can't use something like this following code:
<span class='maincaptionsmall'><a href="http://google.com">Test</a></span>
So, How can i use jquery to get this css element maincaptionsmall
and it will set it to href link ?
Even I can't use <div>
too, I should use everything as <span>
Please give me an example that how to use jquery to set css element as href link.
Thanks in advance
For getting
.maincaptionsmall
this DOM using jQuery use below code,and for wrapping innerText you can use
wrapInner
Live Demo
Edit
You need to wrap code inside
document.ready
and also your document is not properly structured.