SINTAX :
(selector).html() (selector).html(value)
(selector).html(callback)
(selector).val() (selector).val(value)
(selector).val(callback)
(selector).text() (selector).text(value)
(selector).text(callback)
jQuery Get Content – val() html() text()
val() >>>> returns the value of input tags
text() >>>>> returns the innerText of
an element
html() >>>>> returns the
innerHtml of an element
An overload of both functions accepts a function to set the
value, providing the current value of the element :
SAMPLE CODE :
<script>
$(document).ready(function(){
$("button").click(function(){
$("input:text").val(function(index,current){
return current +
" new value";
});
});
});
</script>
That’s all: enjoy HTML5!!!
by carmel schvartzman
עריכה: כרמל שוורצמן
No comments:
Post a Comment