Javascript: Difference between revisions

Jump to navigation Jump to search
44 bytes removed ,  17 May 2013
m
Line 3: Line 3:
== Get the document by id ==
== Get the document by id ==
* <nowiki>document.getElementById('abcId')</nowiki>
* <nowiki>document.getElementById('abcId')</nowiki>
* alternative: (1) Get the id attribute by using jQuery attr(): <nowiki>$("selector").attr("id");</nowiki><ref>[http://api.jquery.com/attr/ .attr() | jQuery API Documentation]</ref> ([http://jsfiddle.net/planetoid/Ffvwz/ example]) and (2) go to the first step
* alternative: (1) Get the id attribute by using jQuery [http://api.jquery.com/attr/ .attr()]: <nowiki>$("selector").attr("id");</nowiki> ([http://jsfiddle.net/planetoid/Ffvwz/ example]) and (2) go to the first step
* parallel naming rules for html elemnt tags ex: (1)<nowiki><input id='checkbox_id1' > & <select id="select_id1"></nowiki> (2)Replace the input id to select id. Code snippet as follows:
* parallel naming rules for html elemnt tags ex: (1)<nowiki><input id='checkbox_id1' > & <select id="select_id1"></nowiki> (2)Replace the input id to select id. Code snippet as follows:
<pre>
<pre>

Navigation menu