Newbie question:
I have a web page with a single p element. I thought I could access the p.html() inside an event, but can’t. Is there a way to access the element inside the event as a jQuery element?
<script src="Scripts/jquery-1.8.2.js"></script>
$(function () {
$("p").first().bind('click',null, function (event) {
this.innerHTML = "this works";
this.html('this does not');
});
}
);
thisin handler function is your DOM element.. it doesn’t have.htmlfunction.. wrap it with$to make it a jQuery object and do a.htmlFull code: