Feeds:
Posts
Comments

Archive for the ‘javascript’ Category

following is a JavaScript code snippet using Powerful JQuery library for dealing with select HTML tag (which is – by the way – pain to deal with core javascript language).

the html code

…..

<select id=”my-ml-list” name=”my-ml-list”>

<option value=”java”>XML</option>

<option value=”java”>HTML</option>

<option value=”java”>XHTML</option>

<option value=”java”>HAML</option>

<option value=”java”>YAML</option>

<option value=”java”>YASL</option>

</select>

…..

what can jquery do for you with this list, some is follow:

iterate on all elements

<script language=”javascript”>

$(“my-ml-list option”).each (

function () {

// this object is the current option HTML object.

alert(“current option value is: ” + this.value); // show message of it’s value.

}

);

</script>

Read Full Post »