Do i need a hashtag in Javascript to pass as a Div
Posted
by
Mike
on Stack Overflow
See other posts from Stack Overflow
or by Mike
Published on 2013-11-12T03:50:15Z
Indexed on
2013/11/12
3:53 UTC
Read the original article
Hit count: 118
How do i insert this php DivSomething into Javascript? Since Javascript needs a hashtag to recognize that as a div. Is there a way to tell JS that this is a Div or there's other better way to do it? Any help would be very much appreciated.
<script>
/*How do i insert a var DivSomething into JS with a hashtag */
/* DivSomething is php dynamic. It returns a Div. It can be #Div1, #Div2, #Div3... */
var DivSomething = '<?php echo $Highlight; ?>'
$(function() {
$('#MouseHere').hover(function() {
$('#' + DivSomething).css('background-color', '#ffffff');
}, function() {
// on mouseout, reset the background colour
$('#' + DivSomething).css('background-color', '');
</script>
© Stack Overflow or respective owner