I am currently developing a responsive website.
I’ve developed a jquery script that changes the href attribute in a link.
$("a.modal").attr("href", "https://secured.sirvoy.com/book.php?c_id=1602&h=ea3a7c9286f068fb6c1462fad233a5e0")
Its working all fine – but i want it only to target devices that has a lesser screen width than 767 pixels (mobile devices).
this script should work but i cant really get it to work.
<script type="text/javascript">
$(document).ready(function(){
if ($(window).width() < 767) {
$("a.modal").attr("href", "https://secured.sirvoy.com/book.php?c_id=1602&h=ea3a7c9286f068fb6c1462fad233a5e0")
}
});
</script>
Link to the webpage.
http://visbyfangelse.se.linweb63.kontrollpanelen.se/rum-priser/
Its the link for the pink buttons i want to change.
The problem lies in the rest of your code, actually. Shame on you for making me dig for it. 😛
So, you prevent the href from firing because of preventDefault. Why not just patch your check in here:
Added | Full text of function to help OP make his project work: