javascript - does netsuite support preventDefault()? -


im using bootstrap create tab content. works fine outside netsuite. once put page netsuite gives me error saying "cannot assign read property 'preventdefault' of error"

my page this

html:

<ul id="hiretab" class="nav nav-tabs" data-tabs="tabs">      <li class="active"><a href="#tabone" data-toggle="tab">one</a>      <li class="active"><a href="#tabtwo" data-toggle="tab">two</a>      <li class="active"><a href="#tabthree" data-toggle="tab">three</a> </ul>  <div  class="tab-content">     <div id="tabone" class="tab-pane active">         one, 1 one     </div>     <div id="tabtwo" class="tab-pane active">         two, 2 two     </div>     <div id="tabthree" class="tab-pane active">         three, 3 three     </div> </div> 

js:

<script type="text/javascript">     jquery(function() {        jquery('#hiretab a').click(function(e) {            e.preventdefault();            jquery(this).tab('show');        });     }); </script> 

on closer found tab changing working. after tab changes, preventdefault doesnt stop page junmping.

any idea why or solution? new netsuite bear me if question stupid.

update: 1 hr of googling lead me page. http://backbonejs.org/#router appears backbone hijacking browser , changed behavior of it.

the syntax href="#xxx" intercepted backbone , interpreted "home_url/xxx".

the problem how stop backbone doing when dont want mess backbone code while im not sure how effect other parts of project.

my temporary solution event.stoppropagation().

final working code is:

<script type="text/javascript">     jquery(function() {        jquery('#hiretab a').click(function(e) {            e.preventdefault();            e.stoppropagation();            jquery(this).tab('show');//maybe line not needed        });     }); </script> 

what function kills request , stop going dom tree.

description: prevents event bubbling dom tree, preventing parent handlers being notified of event.

it brutal way of doing this. im sure there more elegant or native of getting work.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -