Reputation: 23
I'm working on customizing a page, and want to change a specific field's text to render as bold. When I inspect the field with chrome it has
<span id="_Datacomp_name" class="VIEWBOX" style="WIDTH:"100px"">testCompany</span>
How can I use JQUERY to select this field and then make it bold?
I understand HTML, but am new to JQUERY.
I thought using this would work:
<script src="ajax.googleapis.com/.../jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#_Datacomp_name").AwesomeBoldFunctionHere;
</script>
Upvotes: 0
Views: 73
Reputation: 402
In JavaScript you can do this,
document.getElementById("_Datacomp_name").style.fontweight = "bold";
In JQuery,
$("#_Datacomp_name").css("font-weight", "bold");
In CSS,
#_Datacomp_name {
font-weight:bold;
}
Upvotes: 0
Reputation: 4885
$(function() {
$('#_Datacomp_name').css('fontWeight', 'bold');
});
Documentation: jQuery.css Working demo
And... If you're wondering about the $(function() { })
syntax jQuery.ready:
All three of the following syntaxes are equivalent:
$( document ).ready( handler )
$().ready( handler ) (this is not recommended)
$( handler )
Being the handler
your function() { }
Upvotes: 0