Hi guys,
I have the following element that I want to be able to change.
<span id="imageCount">5</span>
This displays a numeric count of images in a folder. When someone deletes/adds an image, I need to increase this via JS. (upon page refresh, it will be updated, but until then I need to update it).
Using the element ID of 'imageCount', what would be the best way to change it?
*This imagecount variable '5' or whatever is just going to be a string.. I haven't declared it as a numeric js variable. So before doing the increase/decrease (+1 or -1), I'd need to strip the contents out of that element and make it numeric..
Thoughts?
I have the following element that I want to be able to change.
<span id="imageCount">5</span>
This displays a numeric count of images in a folder. When someone deletes/adds an image, I need to increase this via JS. (upon page refresh, it will be updated, but until then I need to update it).
Using the element ID of 'imageCount', what would be the best way to change it?
*This imagecount variable '5' or whatever is just going to be a string.. I haven't declared it as a numeric js variable. So before doing the increase/decrease (+1 or -1), I'd need to strip the contents out of that element and make it numeric..
Thoughts?
Code:
$('#imageCount' + i)
Code:
$('##imageCount').replaceWith('('##imageCount + 1)');
Last edited: