P
P
Platton2015-05-04 12:22:15
JavaScript
Platton, 2015-05-04 12:22:15

2 JS scripts conflict?

Separately, norm scripts work, but if they are together, they cease to work.

var $j = jQuery.noConflict();
$j(document).ready(function() {
$j('ul.tabs1 li').css('cursor', 'pointer');
$j('ul.tabs1 li').click(function(){
  var thisClass = this.className.slice(0,2);
  $j('div.t1').hide();
  $j('div.t2').hide();
  $j('div.t3').hide();
  $j('div.t4').hide();
  $j('div.' + thisClass).show();
  $j('ul.tabs1 li').removeClass('tab-current');
  $j(this).addClass('tab-current');
  });
});

$( document ).ready(function() {
  $(":input[type=button]","#searchform").click(function() {
    $(this).closest('form').find(':input','option:selected')
     .not(':button, :submit, :reset, :hidden')
     .val('')
     .removeAttr('checked')
     .removeAttr('selected');    
  });
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
gracer, 2015-05-04
@Platton

var $j = jQuery.noConflict();
$j(document).ready(function() {
$j('ul.tabs1 li').css('cursor', 'pointer');
$j('ul.tabs1 li').click(function(){
  var thisClass = this.className.slice(0,2);
  $j('div.t1').hide();
  $j('div.t2').hide();
  $j('div.t3').hide();
  $j('div.t4').hide();
  $j('div.' + thisClass).show();
  $j('ul.tabs1 li').removeClass('tab-current');
  $j(this).addClass('tab-current');
  });
});

$j( document ).ready(function() {
  $j(":input[type=button]","#searchform").click(function() {
    $j(this).closest('form').find(':input','option:selected')
     .not(':button, :submit, :reset, :hidden')
     .val('')
     .removeAttr('checked')
     .removeAttr('selected');    
  });
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question