[Solved] JQuery issue with a back to top function

You should edit your CSS to hide your “Back to Top” button by default, and then show it when the show class is added. #toTop { display: none; background-color: #FF9800; width: 50px; height: 50px; text-align: center; border-radius: 4px; margin: 30px; position: fixed; bottom: 30px; right: 30px; transition: background-color .3s; z-index: 1000; } #toTop.show { display: … Read more

[Solved] How can i extract the values of a multipline string return type [duplicate]

return an array instead: function test(){ var price=”10″; var name=”apple”; var available=”yes”; var p = [price, name, available]; return (p); } var test = test(); console.log(test[0]); // price or an object: function test(){ var price=”10″; var name=”apple”; var available=”yes”; var p = { price: price, name: name, available: available }; return (p); } var test … Read more

[Solved] not working js script

put all in document ready handler and see if helps: <script src=”https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js”></script> <script type=”text/javascript”> jQuery(function($){ var prev = ”; $(‘#zzz img’).click(function(){ if (prev != ”) $(‘#img_’ + prev).css(‘border’, ‘1px solid #eee’); prev = $(this).attr(‘id’).replace(‘img_’, ”); $(this).css(‘border’, ‘1px solid #535666’); $(‘#imgid’).val(prev); }); }); </script> Hoping that you are having jQuery plugin loaded before this script. solved … Read more

[Solved] Change database value [closed]

you can use xmlhttprequest, and the javascript : var xhr = new XMLHttpRequest(); // Create new XHR var url=”http://sample.com/change.php”; // The url var data=”data=sample&back=come”; xhr.open(‘POST’, url, true); // POST is method you can with `POST|GET` xhr.send(data); or it can be simplifer with jquery var url=”http://sample.com/change.php”; // The url var data=”data=sample&back=come”; $.post(url,data,function(callback){ alert(callback); }); and sure … Read more

[Solved] Ampersand in innerHtml() not being read correctly and validating in JS

.innerHTML isn’t a method. For jQuery, it’s $(this).html() or with the native API, it would be this.innerHTML. And use more sensible flow control constructs like a switch statement. Generally, .innerHTML comparison can be touchy. Use .text() instead when you’re only comparing the text content. $(“li.menu-item a.ui-link”).each(function() { switch ($(this).text()) { case “Accounts”: $(this).addClass(“AccountIcon”); break; case … Read more

[Solved] Call Controller action from JavaScript [closed]

Just use an AJAX call: <div id=’some-container’>Loading…</div> <script type=”text/javascript”> $(document).ready(function() { $.get(‘@Url.Action(“Add”, “BankController”)’, function(viewResult) { $(“#some-container”).html(viewResult); alert(viewResult); }); }); </script> 5 solved Call Controller action from JavaScript [closed]

[Solved] Need to display forms as per the checkboxes selected [closed]

If you want the solution in JQuery, here you go: $(“.formGroup”).hide(); $(‘#chooseForm input:checkbox’).on(‘change’, function() { if($(this).is(‘:checked’)) { $(“#” + $(this).val()).show(); } else { $(“#” + $(this).val()).hide(); } }); ​ A complete example: http://jsfiddle.net/exttq/ Hope it helps! 2 solved Need to display forms as per the checkboxes selected [closed]