Reputation: 129
I just figured out that I needed this link to be inside a data
tag, because the data
uses " ", and I can't include both.
Is this possible to do with document.getElementById("id")
?
Or do I need another script for this? As you can tell I'm not the best with JavaScripts yet. Hope to learn a thing or two.
<a href="chat" onclick="return popitup('chat')">Pop</a>
<script>
function popitup(url) {
newwindow=window.open(url,'name','toolbar=no, location=no, status=no, menubar=no, scrollbars=no, resizable=no,height=600,width=330');
if (window.focus) {newwindow.focus()}
return false;
}
</script>
<a href="#" class="emotes show-pop btn btn-default top" data-title="Settings" data-content="<a href="chat" onclick="return popitup('chat')">Pop</a>"><img src="img/settings.png"></a>
Upvotes: 0
Views: 306
Reputation: 586
After referring this stackoverflow post, I tried to reproduce your code as below. Thing you missed is that you need to escape '<','>' and '"'
<a href="chat" onclick="return popitup('chat')">Pop</a>
<script>
function popitup(url) {
newwindow=window.open(url,'name','toolbar=no, location=no, status=no, menubar=no, scrollbars=no, resizable=no,height=600,width=330');
if (window.focus) {newwindow.focus()}
return false;
}
</script>
<a href="#" class="emotes show-pop btn btn-default top" data-title="Settings" data-content='<a href="chat" onclick="return popitup("chat")">Pop</a>'>
<img src="img/settings.png">
</a>
Upvotes: 0
Reputation: 388316
You need to escape the "
in the attribute value
<a href="#" class="emotes show-pop btn btn-default top" data-title="Settings" data-content="<a href="chat" onclick="return popitup('chat')">Pop</a>"><img src="img/settings.png"></a>
Upvotes: 1