Reputation: 1093
Probably this is easy, but I cannot get it work:
Using the following title
attribute, I can display a description text on the defined clickable area:
$("#myElement").attr('title', ‘description text’);
Is it possible to do the above but instead of the title
attribute to use the "finger" cursor?
Maybe like as follows:
$("myElement").cursor("pointer")
Upvotes: 0
Views: 3848
Reputation: 112
$( ".boxClose" ).text( "Title" ).css( 'cursor', 'pointer' );
$("#myElement").append($(".boxClose"));
<style>
.boxClose{
position:absolute;
top:0px;
width:100%;
height:10px;
}
</style>
Use append to add text and change it to cursor .. jquery awesome ..
Upvotes: 1
Reputation: 4808
Yes but I would recommend css over js:
#myelement {
cursor:pointer
}
Not sure if you are looking for the most condensed way to do both of these in js, if so then this would be pretty close:
$('#myElement').title('text here').css('cursor','pointer');
Upvotes: 1
Reputation: 191749
I don't understand what the title and cursor have to do with each other, but you can change styles in jQuery using:
$("myElement").css('cursor', 'pointer')
Note that there is an important difference between HTML attributes and styles. title
is an attribute and is changed via .attr
.
Upvotes: 1