I\'m trying to correct the usual IE bugs around CSS 2.1 and need a way to alter an elements style properties to add a custom text-align style.
Currently in jQuery yo
Is correct?
<script>
$( "#box" ).one( "click", function() {
$( this ).css( "width", "+=200" );
});
</script>
$(this).css({'text-align':'center'});
You can use class name and id in place of this
$('.classname').css({'text-align':'center'});
or
$('#id').css({'text-align':'center'});
how to set center of the textboxes
I think you should use "textAlign" instead of "text-align".
suppose below is the html paragraph tag:
<p style="background-color:#ff0000">This is a paragraph.</p>
and we want to change the paragraph color in jquery.
The client side code will be:
<script>
$(document).ready(function(){
$("p").css("background-color", "yellow");
});
</script>