My text/value in textarea it’s not static – I’m chaning it. I can’t get the current value.
E.g
1
<textarea>
Lorem ipsum
</textarea>
//it's defalut in html file
2
Putting into textarea: Dolores is lorem ipsum
Alert is only showing 1 version("lorem ipsum"), but not second ("Dolores is lorem ipsum"). I’m trying to do it in jquery:
var variable = $("#selector").val();
alert(variable);
What I’m doing wrong?
EDIT
I want to catch it to variable 🙂 Not to alert. Alert is only my test 🙂
when ever you want text just reference it 🙂
EDIT:
If your using tabs UI please review the docs and the event management:
NOTE: $(‘#example’) would be the parent div that holds the tabs and content
Further optimization recommendation.
If you think $(‘#textareaID’) will be called often you may want to cache a reference to it so the selector engine does not have to find it on every instance, this would be done like:
For this line:
Make sure it is inside of a $(document).ready(function() {}); Call and the element is exists
you could check for this by doing:
And wrap the code above like this:
Hope this helps!