below is sample

<span completed></span>

I need below

<span pending></span>

any body help me

Member Avatar for diafol

Hmm. Which DTD are you using? I suspect that this may invalidate your markup. Usually there'd be a property or attribute to hold the value, unless it was an in-built one, like checked, etc. HTML5 allows custom attributes such as:

<span data-status="completed"></span>
<span data-status="pending"></span>

This also makes it easier for JS to "hook onto" the data-status value and to manipulate it. I'm not sure how JS would target your version of span tags.

Member Avatar for diafol

For example:

<span id="myexample"  data-status="completed"></span>

The JS to read:

var ex = document.getElementById('myexample');
var exStat = ex.dataset.status; 
console.log(exStat);

The js to write:

if(exStat == 'completed') exStat = 'pending';

REF: https://developer.mozilla.org/en/docs/Web/Guide/HTML/Using_data_attributes

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.