Skip to main content

[jQuery]: Get and Set value in html element

1. Get value from html input element

$(document).ready(function() {
var test= $('#test_id').val();//get value from input with id #test_id
        alert('test: ' + test);

2. Get value from html label element

$(document).ready(function() {
var test= $('#test_id').text();//get value from label with id #test_id
        alert('test: ' + test);

3. Set value into html hidden element

$(document).ready(function() {
var test= $('#test_id').text();//get value from id #test_id
        alert('test: ' + test);
        $('#hidden_field').val(test);//set value test into id #hidden_field


Popular posts from this blog

It's a new experience for me

Okay, i think i'm kind of coward type, whenever there is some special occasion or some important tasks or duty being assigned to me, i will worry first, i know in another word, it's lack of confident.

For this time, I will be traveling to US on this coming September - of course - it's a business trip , and i will need to apply for US Visa and go for a Visa interview.

So, i completed the application on 7th July 2017 and the earliest Visa interview schedule will be on 25th July 2017.

During the Visa interview scheduling, i still don't feel the heat yet, i started to worry 4 days before the actual interview day.

Starts to imagine all the worst cases that might be happened before/during the interview, and even dream of it- a nightmare that i went to US Embassy without all my documents. **no doubt, i have a stack of documents prepared, from the business invitation letter, itinerary, identification card photocopy, blah blah blah.....and a super ugly 2 * 2 inches photo of min…







对我而言 2017绝对是个充满惊喜 惊吓惊叹的一年 欢送波友Bok - 新的里程碑
好友结婚啦-我是兄弟-真心感谢 让我有机会参与-一起装饰 新娘车 - 在喝了两杯Whiskey之后 

赶上农历新年的聚会 - 也是最后一次和桂蓉的相见 - 所谓珍惜每一次的相见 - 那可能是最后一次 - 这对我来说非常写实 - 愿桂蓉安息 远离一切苦厄
第一年在Sitiawan的新家 过年 - 亲戚一起来热闹 - 左起 我最敬爱的大舅, 大姨,外婆,姨婆,妈妈

可爱的Sara 和醉醺醺的姑姑 (不良示范)


表姐夫每年的农历新年花的心思 让我们有机会尝鲜 Four Loko 我们都醉了

一如往常 争取每一次合照的机会 在外婆搬到大舅家住之后

老了才和弟弟妹妹游Sunway Lagoon