prototypejs - Get the value of element using javascript by its class name -


hi have element :

<div class="price-box">      <span class="regular-price" id="product-price-27">         <span class="price">            ...         </span>       </span>   </div>  <input type="text" name="qty" id="qty" maxlength="12" value="1" title="qty" class="input-text qty" /> 

i have tried value using line

document.getelementbyclassname('input-text qty').value="myvalue" 

but didn't work

how can value without jquery? note : i've included prototype.js in project !

what 1 :

<button type="button" title="add cart" class="button btn-cart" onclick="productaddtocartform.submit(this)"><span><span>add cart</span></span></button> 

i want disable using javascript , class name !!!?

you might looking queryselector:

document.queryselector( ".input-text.qty" ); 

this returns single item, rather nodelist. if nodelist instead, use alternative queryselectorall. keep in mind these methods take css selectors. selectors can use limited browser code executed in. keep simple.

these 2 methods have better browser support getelementsbyclassname, encourage use them instead of taking current approach.

demo:

enter image description here


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -