retrieve text value from an element with jQuery -


if have html element value in it:

<span id="myspan">23</span> 

how can retrieve value (23) , use it? i've tried like:

var num = $("#myspan").text(); 

does not seem work... able use number add other numbers it?

you want parseint. should make sure selector returning dom elements expect to.

var num = parseint($("#myspan").text(), 10); 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

android - layout with fragment and framelayout replaced by another fragment and framelayout -