Reputation: 415
I have this html
<div id="surname">
<span>Name</span>
</div>
I want to get the Name
$('#copySurName').zclip({
path: 'js/ZeroClipboard.swf',
copy: $("surname span").html();
pleas see the #surname span
but I got empty results
Upvotes: 0
Views: 69
Reputation: 2303
Id selection (#) is missing in your Jquery code. Should be $("#surname span").html()
$(function() { // on page load
$('#copySurName').zclip({
path: "http://www.steamdev.com/zclip/js/ZeroClipboard.swf",
copy: $("#surname span").html()
});
});
Upvotes: 4
Reputation: 2094
If You are Using ID
as your jquery
selector , please prefix #
You Can Try This
$("#surname span").html();
Or
$("div#surname span").html();
Upvotes: 1
Reputation: 11693
Use
$('#copySurName').zclip({
path: 'js/ZeroClipboard.swf',
copy: $("#surname > span").html();
Upvotes: 1
Reputation: 5211
$('#copySurName').zclip({
path: 'js/ZeroClipboard.swf',
copy: $("#surname").find("span").html();
});
Upvotes: 1