Page 1 of 1 |
|
Posted: Wed, 14th May 2014 16:44 Post subject: Replacing a content of an anchor with jQuery |
|
 |
I have an anchor that looks like this:
Code: | <a class="slidesjs-previous slidesjs-navigation" href="#" title="Previous">Previous</a> |
I want it to look like this:
Code: | <a href="#" class="slidesjs-previous slidesjs-navigation"><i class="icon-chevron-left icon-large"></i></a> |
there is actualy ::before bewteen <i></i> tags.
Now from what I remember I could do this by pointing at a class and using .html()
So I made a simple script inside my html
Code: | <script type="text/javascript">
$(document).ready(function(){
$("a.slidesjs-previous").html("<i class="icon-chevron-left icon-large">::before</i>");
$("a.slidesjs-next").html("<i class="icon-chevron-right icon-large">::before</i>");
});
</script> |
But nothing happens. I get an 'Uncaught SyntaxError: Unexpected identifier' error :\
What did I miss? :\
"Quantum mechanics is actually, contrary to it's reputation, unbeliveably simple, once you take the physics out."
Scott Aaronson chiv wrote: | thats true you know. newton didnt discover gravity. the apple told him about it, and then he killed it. the core was never found. |
|
|
Back to top |
|
 |
|
Posted: Wed, 14th May 2014 16:48 Post subject: |
|
 |
Well of course you get that error because look at your " <-
Here it's fixed:
Code: |
$("a.slidesjs-previous").html("<i class='icon-chevron-left icon-large'>::before</i>");
$("a.slidesjs-next").html("<i class='icon-chevron-right icon-large'>::before</i>");
|
You just broke the code by using the same quotation marks inside your string.
|
|
Back to top |
|
 |
|
Posted: Wed, 14th May 2014 16:55 Post subject: |
|
 |
Oh that's right! Quotation :S I forgot about that! Thanks Pumpy 
"Quantum mechanics is actually, contrary to it's reputation, unbeliveably simple, once you take the physics out."
Scott Aaronson chiv wrote: | thats true you know. newton didnt discover gravity. the apple told him about it, and then he killed it. the core was never found. |
|
|
Back to top |
|
 |
|
Posted: Wed, 14th May 2014 17:27 Post subject: |
|
 |
You know my bank details 
|
|
Back to top |
|
 |
|
Posted: Wed, 14th May 2014 18:47 Post subject: |
|
 |
Well with the amount of help I've got from you over the years... When I get a job I'll send you some token of gratitude 
"Quantum mechanics is actually, contrary to it's reputation, unbeliveably simple, once you take the physics out."
Scott Aaronson chiv wrote: | thats true you know. newton didnt discover gravity. the apple told him about it, and then he killed it. the core was never found. |
|
|
Back to top |
|
 |
|
Posted: Wed, 14th May 2014 23:34 Post subject: |
|
 |
|
|
Back to top |
|
 |
|
Posted: Thu, 15th May 2014 09:47 Post subject: |
|
 |
If I have a child you can gladly take it xD
*don't plan on having children* 
"Quantum mechanics is actually, contrary to it's reputation, unbeliveably simple, once you take the physics out."
Scott Aaronson chiv wrote: | thats true you know. newton didnt discover gravity. the apple told him about it, and then he killed it. the core was never found. |
|
|
Back to top |
|
 |
Page 1 of 1 |
All times are GMT + 1 Hour |