DotNetNuke - jQuery - Why is this jQuery Watermark plugin not working?

I am using DNN 5.4 with the default google api jquery default link:

alt text

I confirmed that jquery.min.js is loading. I do not know whether to load another jQuery (except the plugin).

I am using Google Code jQuery text box watermark plugin ( Link )

The Web Dev and Firebug toolbar show that both jQuery and the Watermark plugin are loading. This code sits near the top of my skin .ascs:

 <script type="text/javascript" src="/js/watermark/jquery.watermark.min.js"></script>

The following code works (when inputs are enclosed in form tags) in a basic html document. However, when it is placed inside a DNN shell or DNN module, it does not work and generates javascript here.

<script language="javascript" type="text/javascript">
    (function ($) {
        $(document).ready(function () {
            jQuery("#xsearch").watermark("Leave blank for USA");
        })
    })(jQuery);
</script>

SearchString: <input type="text" id="xsearch" name="xsearch" />
<input type="button" value="search" id="xsubmit" name="xsubmit"   />

Error (FireBug):

jQuery("#xsearch").watermark is not a function
[Break on this error] jQuery("#xsearch").watermark("Leave blank for USA"); 

This alternate code generates the same error:

<script language="javascript" type="text/javascript">
    jQuery.noConflict();
    jQuery(function () {
        jQuery("#xsearch").watermark("Leave blank for USA");
        jQuery("#xsubmit").click(
            function () {
                jQuery("#xsearch")[0].focus();
            }
        );
    });
</script>

, , , jQuery $

- , , .

+3
1

, :


<script type="text/javascript" src="/js/watermark/jquery.watermark.min.js">


<script type="text/javascript" src="js/watermark/jquery.watermark.min.js">

js . FireBug net, , script . , dnn, , , http://www.mydomain.com/tabId/80/js/watermark/jquery.watermark.min.js , http://www.mydomain.com/tabId/80/Default.aspx

+3

Source: https://habr.com/ru/post/1765230/


All Articles