I'm hoping this is a quick one but I seem to be having a mental block today.
I have a series of divs which when clicked, I'm wanting to replace a value at the end of my URL.
URL example would be - http://www.test.com/_CMS/edit-product.php?divClick=1
The value I'm wanting to change as the user clicks each div would be divClick=" assigned value to the div "
Hope this makes sense and thanks in advance.
Set an attribute such an id for each div
<div id="1" onClick="MyFunction(this.id)"> </div>
<script>
function Myfunction(clickedId)
{
window.location="http://www.test.com/_CMS/edit-product.php? divClick="+clickedId;
}
</script>
i supposed that you wanted to be redirected to some url when a div is clicked so i added window.location, but you should have said what you wanted to do.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.