Richard Morris
asked on
JQuery Span Write
I need a zero written into empty spans if they are empty, else no change required.
Example:
<span id="empty1"></span> // change to <span id="empty1">0</span>
<span id="empty2">1</span> // no change required
Example fiddle:
http://jsfiddle.net/RichardMorris/D5XJ6/
Example:
<span id="empty1"></span> // change to <span id="empty1">0</span>
<span id="empty2">1</span> // no change required
Example fiddle:
http://jsfiddle.net/RichardMorris/D5XJ6/
Ignore my previous post
Try this,
$('(#empty1,#empty2):empty ').text("0 ");
it should work
Please read the :empty selector at jquery site
http://api.jquery.com/empty-selector/
Duncan
Try this,
$('(#empty1,#empty2):empty
it should work
Please read the :empty selector at jquery site
http://api.jquery.com/empty-selector/
Duncan
ASKER
Hello Duncan,
Doesn't work in my template but this does:
$('#empty1:empty,#empty2:e mpty').tex t("0");
Let me know if this will be okay?
Doesn't work in my template but this does:
$('#empty1:empty,#empty2:e
Let me know if this will be okay?
it works for me at my side,
$('(#empty1,#empty2):empty ').text("0 ");
it might depend on version of jquery
Duncan
$('(#empty1,#empty2):empty
it might depend on version of jquery
Duncan
Both also works I tested at my server
Duncan
Duncan
ASKER
1.10.2 is what's on the server and I can't change it to older.
So what works best for 1.10.2 requirements?
So what works best for 1.10.2 requirements?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Try this
Duncan